29 May
2010
29 May
'10
12:38 a.m.
On Saturday 29 May 2010 02:26:38, Ivan Lazar Miljenovic wrote:
Daniel Fischer <daniel.is.fischer@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).