No subject

Gabriel Gonzalez gabriel439 at gmail.com
Tue Aug 13 20:49:37 CEST 2013


> My preference is to call the new transformer ExceptT, with a basic
monad called Except, in line with most of the other transformers, and
to deprecate ErrorT.  (The rationale for the name is that Either isn't
just for exceptions, and exceptions aren't just for errors.)

Specializing to an identity base monad is usually a misfeature in real code
and only useful for pedagogical purposes.  Experts leave it polymorphic
like this:

expertCode :: (Monad m) => EitherT E m R

By designing the API entirely around the identity specialization you're
optimizing for a narrow skill range of intermediate Haskell programmers who
are:

a) Smart enough to figure out that `ExceptT` is the official generalization
of `EitherT`

b) Not smart enough to figure out how to keep the base monad polymorphic

So I propose that you leave the monad transformer name as `EitherT`, but
use `Except` for the `Identity` specialization:

type Except e r = EitherT e Identity r

This has the nice properties that:

* The identity specialization doesn't conflict with `Either`

* Beginners find `transformers` when they search for `EitherT` as they
inevitably will

* Existing packages that use `EitherT` won't break, thus preserving
compatibility with the code bases that Edwards already mentioned
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130813/abccc18d/attachment.htm>


More information about the Libraries mailing list