2014-05-24 21:01 GMT+02:00 Simon Marechal <simon@banquise.net>:
On 05/24/2014 08:49 PM, Gautier DI FOLCO wrote:
>
> J'ai tenté ça :
> runState (pure (-) <*> pure 4 <*> pure 2) 7

State f `ap1` State g = State $ \x -> let (a, b) = g x in let (c, d) = f
b in (c a, d)
State f `ap2` State g = State $ \x -> let (c, d) = f x in let (a, b) = g
d in (c a, b)

*Xxxx> runState (pure (,) `ap2` put 4 `ap2` put 7) 0
(((),()),7)
*Xxxx> runState (pure (,) `ap1` put 4 `ap1` put 7) 0
(((),()),4)

_______________________________________________
Haskell-fr mailing list
Haskell-fr@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-fr

ok, je suis suis vautré, j'aime mieux ça ^^
Merci.