Proposal: merge either into transformers

Edward Kmett ekmett at
Mon Jan 2 09:37:48 UTC 2017

I sympathize. If you feel the need for those combinators, you can talk to
Ross to try to get him to add them to the library. (Well, secondEitherT is
already fmap, of course.) When the ExceptT API was crafted, it pretty much
tried to follow the API of the rest of transformers, and didn't really take
any of the extra combinators we had in the either package into account. =/

You might have a hard time getting the last one adopted, though, due to the
dependency on exceptions taking the API into "non-standard" territory.

Unfortunately, even if Ross adds them, I have no way to supply them in
transformers-compat when used with middle versions of transformers that
have ExceptT, but not those combinators, so the compatibility hack I offer
will suffer a bit.


On Mon, Jan 2, 2017 at 2:14 AM, Erik de Castro Lopo <mle+hs at>

> Edward Kmett wrote:
> > Indeed. A proper "EitherT" was added, but due to bikeshedding turned into
> > ExceptT in the process complicating the migration story a fair bit. To
> get
> > a version of ExceptT for older transformers versions you can use
> > transformers-compat, so there is at least some migration story. =/
> Thanks Ed.
> I'm really only interested in GHC 7.10 and later, but there are a number of
> combinators in Control.Monad.Trans.Either that seem to be missing from
> Control.Monad.Trans.Except and in my day job we have a extended version of
> Control.Monad.Trans.Either that has yet more combinators that I miss
> whenever
> I write code outside the work environment.
> Combinators in C.M.T.Either but not in C.M.T.Except:
>    bimapEitherT :: Functor m => (e -> f) -> (a -> b) -> EitherT e m a ->
> EitherT f m b
>    -- really just an alias for EitherT constructor
>    hoistEither :: Monad m => Either e a -> EitherT e m a
> Combinators which I am used to using at work include:
>    firstEitherT :: Functor m => (x -> y) -> EitherT x m a -> EitherT y m a
>    secondEitherT :: Functor m => (a -> b) -> EitherT e m a -> EitherT e m b
>    tryEitherT :: (Functor m, MonadCatch m, Exception e) => (e -> x) -> m a
> -> EitherT x m a
> There are probably others which I can't remember just now.
> Whats the right place for these, the C.M.T.Except or somewhere else? I'd
> prefer not to have to carry them from project to project.
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list