[Haskell-cafe] Re: [Haskell] ANNOUNCE: control-monad-exception 0.5 with monadic call traces

Jason Dusek jason.dusek at gmail.com
Mon Dec 7 15:39:10 EST 2009

2009/12/07 klondike <klondikehaskellcafe at xiscosoft.es>:
> Well I got used to going back to the previous state without
> crashing when I got a precondition violation due to user
> input. Though I assume that was asking a bit too much of
> Haskell.

  It's too much to ask of partial functions. If you want to
  state your preconditions and rollback in an appropriate monad,
  that's of a horse of a different color.

> Of course crashing the whole program as default behaviour is a
> better way to solve the problem.

  If you're not working in a side-effecting or sequential subset
  of the language, you can't really expect to have a consistent
  notion of the state "before" the crash. It's a declarative,
  lazy language, after all.

  Consider, also, that a crash is just one of the problems you
  get with bad input; another one is infinite loops. As Henning
  Thielemann points out in his wiki article, you can't expect to
  catch those as they don't throw exceptions or cause any
  errors! You need to validate the input or use a timer in that
  case. Relying on the program to crash in a timely manner if
  something is wrong with the input is not a strategy that is
  going to go the distance.

Jason Dusek

More information about the Haskell-Cafe mailing list