<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-06-12 3:42 GMT+02:00 adam vogt <span dir="ltr"><<a href="mailto:vogt.adam@gmail.com" target="_blank">vogt.adam@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Gautier,<br>
<br>
It seems like `type State s = StateT s Identity` causes the problem.<br>
You could supply Identity as an argument:<br>
<br>
data REnv (ts :: [*])<br>
          (i :: *)<br>
          (o :: *)<br>
          (s :: * -> (* -> *) -> * -> *)<br>
          (k :: (* -> *) -> * -> * -> *) where<br>
  Last  :: k (s t Identity) i o -> REnv (t ': '[]) i o s k<br>
  RCons :: k (s t Identity) i o' -> REnv ts o' o s k -> REnv (t ': ts) i o s k<br>
<br>
<br>
Or I guess you could keep the original REnv, and require a newtype<br>
<br>
newtype MyState s a = MyState (State s a)<br>
   deriving (MonadState s, Monad)<br>
<br>
Regards,<br>
Adam<br>
<div><div class="h5"><br>
<br>
On Wed, Jun 11, 2014 at 3:31 PM, Gautier DI FOLCO<br>
<<a href="mailto:gautier.difolco@gmail.com">gautier.difolco@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> My goal is to compose Kleisli arrows with (State s) as parameteric Monadic<br>
> type.<br>
> So, I end up with the following code:<br>
><br>
> data REnv :: [*] -> * -> * -> (* -> * -> *) -> ((* -> *) -> * -> * -> *) -><br>
> * where<br>
>   Last  :: k (s t) i o -> REnv (t ': '[]) i o s k<br>
>   RCons :: k (s t) i o' -> REnv ts o' o s k -> REnv (t ': ts) i o s k<br>
><br>
><br>
> Which, of course, gives me the following error when I try to play with it:<br>
><br>
> *H> :t Last genRanking<br>
><br>
> <interactive>:1:6:<br>
>     Kind incompatibility when matching types:<br>
>       s :: * -> * -> *<br>
>       StateT Ranking :: (* -> *) -> * -> *<br>
>     Expected type: Kleisli (s t) Ticket Ranking<br>
>       Actual type: Kleisli (State Ranking) Ticket Ranking<br>
>     In the first argument of ‘Last’, namely ‘genRanking’<br>
>     In the expression: Last genRanking<br>
><br>
> <interactive>:1:6:<br>
>     Kind incompatibility when matching types:<br>
>       t :: *<br>
>       Data.Functor.Identity.Identity :: * -> *<br>
>     Expected type: Kleisli (s t) Ticket Ranking<br>
>       Actual type: Kleisli (State Ranking) Ticket Ranking<br>
>     In the first argument of ‘Last’, namely ‘genRanking’<br>
>     In the expression: Last genRanking<br>
> *H> :t Last<br>
> Last :: k (s t) i o -> REnv '[t] i o s k<br>
> *H> :t genRanking<br>
> genRanking :: Kleisli (State Ranking) Ticket Ranking<br>
><br>
><br>
> I understand why it fails (State is * -> * -> *, while s is * -> *), but I<br>
> can't figure out how to write this, I tried (s t o), but it isn't correct<br>
> because k waits for a (* -> *).<br>
><br>
><br>
> If you have any ideas, I'm curious to read them.<br>
><br>
> Thanks in advance for your help.<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
</blockquote></div><br><br></div><div class="gmail_extra">Hi adam,<br><br></div><div class="gmail_extra">Thanks for your answer, I didn't realized that Identity could cause that.<br><br></div><div class="gmail_extra">
Thanks,<br><br></div><div class="gmail_extra">Regards.<br></div></div>