[Haskell-cafe] Proposal: new function for lifting
Thiago Negri
evohunz at gmail.com
Fri Sep 27 21:51:19 CEST 2013
Everybody is claiming that using lift is a bad thing.
So, I come to remedy this problem.
Stop lifting, start using shinny operators like this one:
(^$) :: Monad m => m a -> (a -> b -> c) -> m b -> m c
(^$) = flip liftM2
Then you can do wonderful stuff and you will never read the four-letter
word in your code again:
\> Just 42 ^$(+)$ Nothing
Nothing
\> Just 10 ^$(+)$ Just 20
Just 30
\> let add = (+)
\> Just 30 ^$ add $ Just 12
Just 42
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130927/ace64913/attachment.htm>
More information about the Haskell-Cafe
mailing list