#4159: move Monad and MonadFix instances for Either from mtl to base
-------------------------+--------------------------------------------------
Reporter: ross | Owner:
Type: proposal | Status: closed
Priority: normal | Component: libraries/base
Version: 6.12.3 | Resolution: fixed
Keywords: | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: None/Unknown |
-------------------------+--------------------------------------------------
Changes (by ross):
* status: new => closed
* resolution: => fixed
Comment:
There was a lengthy discussion. Beyond the move, the change involves a
classic trade-off: the Either monad instance becomes usable on arbitrary
types, but the fail method becomes less useful; in particular, pattern
match failure in this monad becomes an error.
More than a dozen people were in favour of the change. A popular argument
was that Either is a general purpose type modelling categorical sum, so it
should have the simple and familiar monad instance.
There were two arguments against, in different directions:
* Claus Reinke wished to retain pattern match failure. We considered
adding {{{fail s = Left (error s)}}} but this would please no-one: for the
pattern matching use it would be equivalent to using the Maybe monad
instead.
* Iavor Diatchki opposed defining any instance of Monad Either, arguing
that it promoted bad style. It was pointed out that because instances in
Haskell are effectively global, most code already has the instance.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4159#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs