Proposal to solve the `EitherT` problem.

Gabriel Gonzalez gabriel439 at gmail.com
Wed Aug 14 16:50:58 CEST 2013


On 08/14/2013 12:42 AM, Daniel Trstenjak wrote:
> On Tue, Aug 13, 2013 at 06:57:22PM -0400, Edward A Kmett wrote:
>> I look forward to finding out the new name for MaybeT then. ;)
> That's a bit unfair, because the Maybe data type has a clear meaning
> which also holds for its Monad instance.

What is the distinction?  For me, `Maybe` is as language-neutral as 
`Either`.  It simply augments a value with an additional state with no 
connotation of error handling.  If you were really trying to be 
consistent, you would rename `MaybeT` to `FailableT` and remove the 
`Monad` instance from `Maybe`.

> That's not the case for Either. The Either data type doesn't propose
> a special meaning to the 'Left' or 'Right' case, but the Monad
> instance of Either does.

No, it does not have a special meaning.  Bot the `Either` and `Maybe` 
monads are also used for short-circuiting.  See here:

http://www.haskellforall.com/2012/07/breaking-from-loop.html

This isn't hypothetical: I do this all the time in my programming. By 
your logic, I should remove the `Monad` instance for `Maybe` because 
it's unclear in my code whether I'm using it in its capacity for error 
handling or for general-purpose short-circuiting.




More information about the Libraries mailing list