
Ian Lynagh wrote:
The only way you can have problems is if there is a library (that you don't control), which exports a (MonadIO m => m a) that internally calls readlineFunction args and doesn't catch exceptions. Personally I'd say that that is a bug in that other library, and it ought to be catching the exception and either ignoring it, returning some sort of sum type, or also constraining m to be in some sort of MonadError monad.
Agreed. I think that in this situation our function should have a type that allows the type system to check that.
If we start throwing IO exceptions for common and minor occurrences like no readline history available
Pretty much any actual IO you do has this problem, e.g. readFile on a non-existent file.
Those are asynchronous phenomena. It is reasonable for some programs to ignore them completely, assuming that they are being taken care of on the outside, and allowing the program to fail when they are not. So an IO exception is appropriate. Regards, Yitz