[Haskell-beginners] ap = liftM2 id

Rein Henrichs rein.henrichs at gmail.com
Fri Mar 27 00:34:46 UTC 2015


Following up on Andres's explanation, we have

ap f x = liftM2 id mf ma                          -- definition of ap
       = do { f <- mf; a <- ma; return (id f x) } -- definition of liftM2
       = do { f <- mf; a <- ma; return (f x) }    -- definition of id, f x
y = (f x) y

We can see that id applied to f gives f which is then applied to a.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150326/588c00e2/attachment.html>


More information about the Beginners mailing list