On Fri, 8 May 2020, Niklas Hambüchen wrote:
What are "unintended exceptions"?
What is an example of an "unintended exception"?
A recent example from my production server:
hPutBuf: resource vanished (Broken pipe)
Ok, I lookup the Haddock comment of hPutBuf and it says:
"This operation may fail with:
* ResourceVanished if the handle is a pipe or socket, and the reading end
is closed."
That is, ResourceVanished is part of the public interface and in no way
unexpected (or what "unintended" may be). I would prefer to make this
explicit in the type of hPutBuf:
hPutBuf ::
(ResourceVanishedException e) =>
Handle -> Ptr a -> Int -> ExceptT e IO ()
Now, what do you intend to do with the call-stack? Isn't it something you
can attach to the e value?_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users