[Haskell-cafe] Decorating exceptions with backtrace information

Niklas Hambüchen mail at nh2.me
Tue May 12 22:14:30 UTC 2020

On 5/12/20 10:55 PM, Henning Thielemann wrote:
> "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?

Why is this relevant?

The point of debugging is to find programming errors.
It does not matter what the Haddocks say; if a programmer uses the function wrong, the exception will occur.

hPutBuf does not currently have that type, nor can anybody rewrite all the existing libraries easily.

The point of the proposal is to make the RTS help us debug problems in code as it exists today.

More information about the ghc-devs mailing list