Hi all,

My goal is to compose Kleisli arrows with (State s) as parameteric Monadic type.
So, I end up with the following code:
data REnv :: [*] -> * -> * -> (* -> * -> *) -> ((* -> *) -> * -> * -> *) -> * where
  Last  :: k (s t) i o -> REnv (t ': '[]) i o s k                            
  RCons :: k (s t) i o' -> REnv ts o' o s k -> REnv (t ': ts) i o s k

Which, of course, gives me the following error when I try to play with it:
*H> :t Last genRanking 

<interactive>:1:6:
    Kind incompatibility when matching types:
      s :: * -> * -> *
      StateT Ranking :: (* -> *) -> * -> *
    Expected type: Kleisli (s t) Ticket Ranking
      Actual type: Kleisli (State Ranking) Ticket Ranking
    In the first argument of Last, namely genRanking
    In the expression: Last genRanking

<interactive>:1:6:
    Kind incompatibility when matching types:
      t :: *
      Data.Functor.Identity.Identity :: * -> *
    Expected type: Kleisli (s t) Ticket Ranking
      Actual type: Kleisli (State Ranking) Ticket Ranking
    In the first argument of Last, namely genRanking
    In the expression: Last genRanking
*H> :t Last
Last :: k (s t) i o -> REnv '[t] i o s k
*H> :t genRanking 
genRanking :: Kleisli (State Ranking) Ticket Ranking

I understand why it fails (State is * -> * -> *, while s is * -> *), but I can't figure out how to write this, I tried (s t o), but it isn't correct because k waits for a (* -> *).

If you have any ideas, I'm curious to read them.

Thanks in advance for your help.