[Haskell-cafe] Parametrized monads

Miguel Mitrofanov miguelimo38 at yandex.ru
Mon Jun 15 04:39:45 EDT 2009


Hi!

Suppose I want to create a specific monad as a combination of monad transformers - something like "StateT smth1 (ReaderT smth2 Identity)". As 
you can see, each transformer is parametrized with a type of kind *. I want to abstract these parameters, so that instead of "StateT smth..." I 
can write something like

Zip (ConsT StateT (ConsT ReaderT NilT)) (ConsA smth1 (ConsA smth2 NilA)) Identity

and it would be a type isomorphic to the first one. I mean, I want (ConsT StateT (ConsT ReaderT NilT))" to be a separate entity of fixed kind, 
so that I can, say, create a class instance for it or something.

I'd be quite happy if list length appears as a separate parameter, like

Zip (Succ (Succ Zero)) (ConsT ...

I would NOT be happy with something like

Zip (List_2 StateT ReaderT) (Arg_2 smth1 smth2)

If haskell had polymorphic kinds, I'd be able to do it easily; unfortunately, it doesn't have them.

Thanks


More information about the Haskell-Cafe mailing list