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

Roman Cheplyaka roma at ro-che.info
Mon Dec 16 13:12:29 UTC 2013


* Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> [2013-12-17 00:00:16+1100]
> On 16 December 2013 22:15, Roman Cheplyaka <roma at ro-che.info> wrote:
> > * Herbert Valerio Riedel <hvr at gnu.org> [2013-12-16 10:53:21+0100]
> >> Why not simply use the existing `fail :: String -> IO a` method instead?
> >
> > The purpose of 'fail' is to handle monadic pattern-match failures.
> > I consider explicit use of 'fail' in user code a hack.
> 
> Or for use with parser-combinator libraries (though I suppose this
> could be seen as a pattern-match failure...)?

I'd consider that an abuse, too. E.g. Parsec provides a parserFail
function that you can call instead.

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.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/libraries/attachments/20131216/9e67ceae/attachment.sig>


More information about the Libraries mailing list