
24 Nov
2010
24 Nov
'10
8:44 p.m.
I'd been playing with pointfree, looking at what certain patterns transformed into, and I came across this: pauls@Mudskipper> pointfree -v "\x -> x + x" ~ Transformed to pointfree style: ap (+) id Optimized expression: ap (+) id join (+) Basically I wanted to see what happened when you used a parameter multiple times within a function. Intrigued by this, I did the following: Prelude Control.Monad> :t ap (+) id ap (+) id :: (Num a, Monad ((->) a)) => a -> a I'm aware that 'ap' is related the liftM, but what is this monad, and why are we working in a monad at all? ...and surely this isn't the same as the original code as we now have a different type signature?