Re: [Haskell-cafe] Decorating exceptions with backtrace information
Henning Thielemann <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.ghc.devel,gmane.comp.lang.haskell.glasgow.user,gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <alpine.DEB.2.20.2005122246340.5603@sputnik> |
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?
_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs