x `f` y = x >>= (return . y)
flip fmap, , , import Data.Functor, fmap
y <$> x
( , Functor Monad, .)
, ,
munge = Just . remove bits . add things <$> operation 1
>>= increase something <$> operation 2
munge' = do
thing1 <- operation 1
let thing2 = Just . remove bits. add things $ thing1
thing3 <- operation 2
return . increase something $ thing3
, import Control.Applicative ( <$>), , :
addLine = (+) <$> readLine <*> readLine >>= print
addLine' = do
one <- readLine
two <- readLine
print (one + two)
--, Monads (, , ). .
, pure = return
mf <*> mx = do
f <- mf
x <- mx
return (f x)
Functor,
fmap f mx = do
x <- mx
return (f x)
(<*>) = ap fmap = liftM,
Control.Monad, , , , .