fmap (+1) [1,2,3] -- [2,3,4]
(+1) <gt; [1,2,3] -- [2,3,4]
(+1) <gt; Just 1 -- Just 2
Just (+1) <*> Just 1 -- Just 2
Just 1 >>= \x -> Just $ x + 1 -- Just 2
Just 1 >>= \x -> pure $ x + 1 -- Just 2
Just 1 >>= \x -> return $ x + 1 -- Just 2
do block
module Main where
test :: Monad m => m Integer
test = pure 233
result :: Monad m => m Integer
result = do
value <- test
return $ value + 1
main :: IO ()
main = result >>= print