[Haskell-cafe] Flipping type constructors
Tony Morris
tonymorris at gmail.com
Tue Aug 14 01:38:40 CEST 2012
I have a data-type that is similar to EitherT, however, I have ordered
the type variables like so:
data EitherT (f :: * -> *) (a :: *) (b :: *) = ...
This allows me to declare some desirable instances:
instance Functor f => Bifunctor (EitherT f)
instance Foldable f => Bifoldable (EitherT f)
instance Traversable f => Bitraversable (EitherT f)
However, I am unable to declare a MonadTrans instance:
instance MonadTrans (EitherT a) -- kind error
I looked at Control.Compose.Flip to resolve this, but it does not appear
to be kind-polymorphic.
http://hackage.haskell.org/packages/archive/TypeCompose/0.9.1/doc/html/src/Control-Compose.html#Flip
I was wondering if there are any well-developed techniques to deal with
this? Of course, I could just write my own Flip with the appropriate
kinds and be done with it. Maybe there is a more suitable way?
--
Tony Morris
http://tmorris.net/
More information about the Haskell-Cafe
mailing list