Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created Jan 21, 2015
Embed
What would you like to do?
flip' :: (a -> b -> c) -> (b -> a -> c)
flip' f = g
where g x y = f y x
flip'' :: (a -> b -> c) -> b -> a -> c
-- flip'' :: a -> b -> c -> b -> a -> c -- このように書くとエラー
flip'' f x y = f y x
main = do
print $ flip' map [1..5] (* 2)
print $ flip'' map [1..5] (* 3)
print $ flip'' zip [1..5] "hello"
print $ flip'' zip "hello" [1..5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment