Proposal: die to System.Exit (and/or Prelude)

Andreas Abel andreas.abel at ifi.lmu.de
Mon Dec 16 13:54:53 UTC 2013


On 16.12.2013 14:12, Roman Cheplyaka wrote:
>>> The purpose of 'fail' is to handle monadic pattern-match failures.
>>> I consider explicit use of 'fail' in user code a hack.
>
> I treat 'fail' as a semi-private method of the Monad class. I may
> override it, but I should never call it. It only exists for the
> compiler.

This is useful information.  Please add it to the documentation.  That 
would definitely help newcomers to get some orientation in the design 
space of exceptions...

 
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Monad.html#t:Monad

   fail :: String -> m a

   Fail with a message. This operation is not part of the mathematical 
  definition of a monad, but is invoked on pattern-match failure in a do 
expression.

-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/


More information about the Libraries mailing list