Created
January 22, 2014 02:49
-
-
Save programatt/8552689 to your computer and use it in GitHub Desktop.
Haskell Function Composition with multiple arguments example
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
f :: [Bool] -> Bool | |
f = and | |
g :: (Eq a) => ([a],[a]) -> [Bool] | |
g = uncurry $ zipWith (==) | |
h :: (Eq a) => ([a],[a]) -> Bool | |
h = f . g | |
f' :: [Bool] -> Bool | |
f' = and | |
g' :: (Eq a) => [a] -> [a] -> [Bool] | |
g' = zipWith (==) | |
h' :: (Eq a) => [a] -> [a] -> Bool | |
h' xs ys = (f' . uncurry g')(xs,ys) | |
main :: IO () | |
main = do | |
print $ h ([1,2,3],[1,2,3]) | |
print $ h' [1,2,3] [1,2,3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
;-)