Created
April 11, 2014 11:32
-
-
Save eungju/10460521 to your computer and use it in GitHub Desktop.
Factor cleave words 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
bi :: (a -> b) -> (a -> c) -> a -> (b, c) | |
bi f g (x) = (f x, g x) | |
bi2 :: (a -> b -> c) -> (a -> b -> d) -> (a, b) -> (c, d) | |
bi2 f g (x, y) = (f x y, g x y) | |
tri :: (a -> b) -> (a -> c) -> (a -> d) -> a -> (b, c, d) | |
tri f g h (x) = (f x, g x, h x) | |
tri2 :: (a -> b -> c) -> (a -> b -> d) -> (a -> b -> e) -> (a, b) -> (c, d, e) | |
tri2 f g h (x, y) = (f x y, g x y, h x y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment