[Haskell-fr] Fw: Éclaircissements sur les monades

Gautier DI FOLCO gautier.difolco at gmail.com
Sat May 24 19:06:53 UTC 2014


2014-05-24 21:01 GMT+02:00 Simon Marechal <simon at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-fr
>

ok, je suis suis vautré, j'aime mieux ça ^^
Merci.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-fr/attachments/20140524/25b1d8d0/attachment.html>


More information about the Haskell-fr mailing list