* Ivan Lazar Miljenovic <ivan.miljenovic@gmail.com> [2013-12-17 00:00:16+1100]
On 16 December 2013 22:15, Roman Cheplyaka <roma@ro-che.info> wrote:
* Herbert Valerio Riedel <hvr@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