Readline read_history and write_history addition

Ian Lynagh igloo at earth.li
Tue Jan 22 17:13:26 EST 2008


On Mon, Jan 21, 2008 at 08:34:50PM -0800, Alexander Dunlap wrote:
> 
> However, I'm not sure how we would implement it without using error.
> The usual Haskell solution would be to use Maybe, but what would we
> have Just of, since the functions don't return real values? Is Just ()
> an accepted idiom?

Bool would be nicer than that, but presumably these functions can fail
in a number of ways, so better still would be Maybe Exception or Maybe
IOError. I think in my opinion throwing an exception is best, though.

People using MonadIO can convert this into the variant that doesn't
throw an exception by replacing
    readlineFunction args
with something like
    (try $ readlineFunction args) >> return ()


Thanks
Ian



More information about the Libraries mailing list