haskell-cafe@haskell.org
[Top] [All Lists]

Re: [Haskell-cafe] IO (Either a Error) question

Subject: Re: [Haskell-cafe] IO (Either a Error) question
From: Ross Paterson
Date: Sat, 8 May 2010 01:15:11 +0100
On Sat, May 08, 2010 at 01:54:21AM +0200, Limestraël wrote:
> > Personally I think fail is a terrible wart, and should be shunned.
> 
> So do I.
> I can't understand its purpose since monads which can fail can be implemented
> through MonadPlus.

It was introduced to implement pattern match failure in do-notation,
in Section 3.14 of the Haskell Report:

  do {p <- e; stmts} = let ok p = do {stmts}
                           ok _ = fail "..."
                       in e >>= ok
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>