[Haskell-cafe] Swapping type arguments

Alexey Uimanov s9gf4ult at gmail.com
Fri May 1 19:32:50 UTC 2015


This question probably asked already.

I have a type

data T m b a = T (m (b, a))

and it should be instance of `Bifunctor` and `MonadTrans` same time. But
there is a problem:

instance Bifunctor (T m)

is ok, but

instance MonadTrans (T ...

is not, because first argument is `m` but we need `b`. Type can be
rewritten like

data T b m a = T (m (b, a))

and instance of MonadTrans is ok:

instance MonadTrans (T b)

but how to define Bifunctor?

instance Bifunctor (T ...

I did not found how to workaround this. Is there any type magic for such
cases?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150502/dae29057/attachment.html>


More information about the Haskell-Cafe mailing list