Created
June 27, 2018 06:03
-
-
Save scalolli/01eb0b4bf1069d1e976b4a548dbcb016 to your computer and use it in GitHub Desktop.
How Haskell Compose works
This file contains 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
λ> (\x -> Cons' x Nil') <$> (Just $ Right 5) | |
Just (Cons' (Right 5) Nil') | |
-- The whole reason of using Compose is acting as a type constructor, here we ended up making Just and Right part | |
-- of the Compose structure hence we only 5 is passed to the function (\x -> Cons' x Nil) | |
λ> (\x -> Cons' x Nil') <$> (Compose $ Just $ Right 5) | |
Compose (Just (Right (Cons' 5 Nil'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment