Created
August 26, 2015 00:53
-
-
Save TheSeamau5/849a5d169dc10b662a98 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
type alias Function a b = a -> b | |
const : b -> Function a b | |
const b _ = b | |
compose : Function a b -> Function b c -> Function a c | |
compose = | |
(>>) | |
map : (a -> b) -> Function x a -> Function x b | |
map = | |
(<<) | |
contramap : (b -> a) -> Function a x -> Function b x | |
contramap = | |
(>>) | |
map2 : (a -> b -> c) -> Function x a -> Function x b -> Function x c | |
map2 f xa xb x = | |
f (xa x) (xb x) | |
andMap : Function x (a -> b) -> Function x a -> Function x b | |
andMap = | |
map2 (<|) | |
flatten : Function x (Function x a) -> Function x a | |
flatten f x = | |
(f x) x | |
flatMap : (a -> Function x b) -> Function x a -> Function x b | |
flatMap f = | |
map f >> flatten | |
andThen : Function x a -> (a -> Function x b) -> Function x b | |
andThen = | |
flip flatMap | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment