Created
July 9, 2014 18:10
-
-
Save Irio/430a457be0a5d8ab580d to your computer and use it in GitHub Desktop.
Function composition and application in Haskell
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
sumArgs :: Integer -> Integer -> Integer | |
sumArgs x y = x + y | |
times10 :: Integer -> Integer | |
times10 x = x * 10 | |
-- times10 . sumArgs 1 2 will become | |
-- > let composed = \x -> times10 (sumArgs x) | |
-- > composed 1 2 | |
-- error! | |
-- | |
-- times10 . sumArgs 1 $ 2 will become | |
-- > let composed = \x -> times10 ((sumArgs x) 2) | |
-- > composed 1 | |
-- 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment