Fergus Henderson wrote:
[snip]
> What existing functions for testing IOErrors?
> Apart from the Eq and Show classes, Haskell 98 doesn't define any, AFAIK.
> If you're suggesting that Eq or Show be undefined for IOErrors that
> represent sets of exceptions, then I would have to disagree...
I must be missing something.  Isn't it blindlingly obvious that
here SML's exception mechanism is streets ahead of Haskell's?  Please,
what am I missing?  Is there some lurking type-unsafeness?
[snip]
>         (a) allow throwing exceptions from arbitrary code, not just from within
>             the IO monad
Aaarrgh no.  If you're going to do unsafe operations then be honest about it
and use IOExts.unsafePerformIO.  Actually I don't often feel the need to do
this (I don't think there's any example in UniForM).  Exceptions tend to be
either because of something IOish (file not found), in which case you are already
doing state, or else because of a bug in the program, in which case "error"
is probably appropriate.  

I suppose the main problem with "error" is that theoretically
you have to crash out of all enclosing Haskell code.  I don't understand
enough about the semantics of haskell to know the answer to this question,
but could you provide a way of wrapping up a value
   a -> Maybe a
so that if somewhere during the evaluation of the a, there is an attempt to
evaluate "error", the result is Nothing (and perhaps an error
message printed on the screen), otherwise Just (something).
Would this break the semantics?



Reply via email to