Proposal: merge either into transformers
Erik de Castro Lopo
mle+hs at mega-nerd.com
Mon Jan 2 07:14:18 UTC 2017
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
http://www.mega-nerd.com/
More information about the Libraries
mailing list