Last active
April 28, 2017 09:16
-
-
Save swr1bm86/23bb7d7672b1d0c5c62f6c43c6375e5e to your computer and use it in GitHub Desktop.
Function (Reader) Monad
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
foo :: Int -> Int | |
foo a = a + 1 | |
bar :: Int -> Int | |
bar a = a - 1 | |
foobar' :: Int -> [Int] | |
foobar' = sequence [foo, bar] | |
foobar :: Int -> Int | |
foobar = sum <$> sequence [foo, bar] | |
foo :: Int -> Int | |
foo a = a | |
:t fmap Just foo => fmap Just foo :: Int -> Maybe Int | |
foo :: Int -> Maybe Int | |
foo a = Just a | |
:t (fmap . fmap) Just foo => (fmap . fmap) Just foo :: Int -> Maybe (Maybe Int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment