[Haskell-cafe] Decorating exceptions with backtrace information

Ben Franksen ben.franksen at online.de
Wed May 13 14:15:17 UTC 2020


Am 12.05.20 um 23:29 schrieb Henning Thielemann:
> A stack overflow sounds like unlimited recursion and thus like a
> programming error.

Perhaps it was just one recursion to many? Computer memory is limited.
Heap overflow is also quite possible even with a program that is
provably terminating. I have used 'ulimit -v' in the past to force ghc
to fail rather than having to reboot my machine :-/

> In contrast to that, a program must be prepared for a
> failure of "malloc".

I don't see any essential difference between allocation by the runtime
and explicit allocation using malloc. I think this is a good thing that
in Haskell you /can/ recover from such a condition.

> Memory exhaustion is an IO exception, it should be
> explicit in the type.

Then it must be explicit in all types, since in general all computations
may exhaust the available memory. And then what use would that type
information have?

> Are MVar deadlocks always detected by the runtime system?

My guess is that deadlock detection in general is undecidable i.e. with
more than one MVar present, but I may be wrong about that.

Cheers
Ben



More information about the Glasgow-haskell-users mailing list