Created
September 25, 2014 05:14
-
-
Save miguel-vila/ff0e6c25c10362af7744 to your computer and use it in GitHub Desktop.
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
def fa[A0,A1](a: A0): A1 = ??? | |
def head[A](l: List[A]): A = l.head | |
def fmap[A,B](f: A => B)(l: List[A]): List[B] = l.map(f) | |
"head and then map is the same as map and then head" { | |
fa[A0,A1] compose head[A0] == head[A1] compose fmap[A0,A1](fa) | |
} | |
def tail[A](l: List[A]): List[A] = l.tail | |
"tail and then map is the same as map and then tail" { | |
fa[A0,A1] compose tail[A0] == tail[A1] compose fmap[A0,A1](fa) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment