Last active
January 17, 2020 13:54
-
-
Save vijayanant/fdb8e772546e3d3a201bcd5bf64334f4 to your computer and use it in GitHub Desktop.
Choose Wisely
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1 + 2 | |
-- (+) 1 2 | |
-- + (Just 1) (Just 2) | |
-- Monadic desugared | |
(Just 1) >>= (\x -> (Just 2) >>= \y -> return (x+y)) | |
-- Monadic sugar | |
do {x <- Just 1; y <- Just 2; return (x+y)} | |
-- Functor + Applicative | |
fmap (+) (Just 1) <*> (Just 2) | |
-- Applicative | |
pure (+) <*> (Just 1) <*> (Just 2) | |
-- Applicative | |
(+) <$> (Just 1) <*> (Just 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment