Say I have a type of kind l :: * -> * -> *
, so I need to apply 2 types for example a
, and b
to get a simple type l a b
.
How can I map the type l :: * -> * -> *
into a new type m(l) :: * -> * -> *
where m(l) b a
means the same as l a b
for every a,b
? Here a,b
are not constants. Is it possible? Is it wrong to think of that?
type M l a b = l b a
newtype M l a b = M (l b a)
Or without taking l
as parameter
data L a b = ...
newtype M a b = M (L b a)
type M a b = L b a
Edit:
type M l a b = l b a
data L a b = L (a Int) (b Int)
type Z = M L Maybe []
Moreover, you can give explicit kind signatures too
type M (l :: k1 -> k2 -> *) (a :: k2) (b :: k1) = l b a