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
fmapEx :: Maybe Int | |
fmapEx = fmap (+ 1) Nothing -- Nothing |
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
fmapEx :: Maybe Int -- A function returning a Maybe Int | |
fmapEx = fmap (+ 1) (Just 42) -- Just 43 |
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
applicativeEx :: Maybe Int | |
applicativeEx = (+ 1) <$> Just 42 -- Just 43 |
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
applicativeEx :: [Int] | |
applicativeEx = [(+ 1)] <*> [1, 2, 3] -- [2, 3, 4] |
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
applicativeEx :: Maybe Int | |
applicativeEx = Just (+ 1) <*> Just 42 -- Just 43 |
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
applicativeEx :: Maybe Int | |
applicativeEx = Just (+ 1) <*> Just 42 -- Just 43 |
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
fmapEx :: [Int] -- A function returning a list | |
fmapEx = fmap (+ 1) [1, 2, 3] -- [2, 3, 4] |
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
fmapEx :: Maybe Int | |
fmapEx = fmap (Just (+ 1)) (Just 42) -- Does not compile |
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
fmapEx :: Maybe Int | |
fmapEx = fmap (+ 1) Nothing -- Nothing |
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
fmapEx :: Maybe Int -- A function returning a Maybe Int | |
fmapEx = fmap (+ 1) (Just 42) -- Nothing |