[Haskell-cafe] Flipping type constructors
hesselink at gmail.com
Sat Aug 18 22:13:49 CEST 2012
The next version of GHC will have an extension for kind polymorphism.
I'm not sure if it has to be enabled in the module that defines flip
or in the module that uses it, but it might help.
On Tue, Aug 14, 2012 at 1:38 AM, Tony Morris <tonymorris at gmail.com> wrote:
> 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.
> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe