[Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

Daniel Fischer daniel.is.fischer at web.de
Fri May 28 20:38:52 EDT 2010


On Saturday 29 May 2010 02:26:38, Ivan Lazar Miljenovic wrote:
> Daniel Fischer <daniel.is.fischer at web.de> writes:
> > But if you want to have
> >
> > instance Monad (Either ConcreteType) where ...
> >
> > , you can have
> >
> >     fail msg = Left someDefaultValue
> >
> > (or let the value depend on the message) and you can construct
> > Left someMeaningfulValue in concrete situations.
>
> Which happens to make it identical to Maybe ;-)

If you use only the default value.
But if you use more, making your type an instance of Error would be the 
sensible thing (unless you're one of the mtl-haters, but probably 
transformers has a similar instance).


More information about the Haskell-Cafe mailing list