Created
August 27, 2013 07:06
-
-
Save strager/6350496 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
| def safeHead([a] -> a?): | |
| ->xs | |
| if (xs isEmpty): | |
| none | |
| else: | |
| xs head some | |
| def find([a] (a -> Bool) -> a?): | |
| filter safeHead | |
| def lookUp([a & b] a (a a -> Bool) -> b?): | |
| ->eq | |
| ->key // 33 | |
| {key eq} find // 34 | |
| {rest} liftOption | |
| /* | |
| stuff.ktn:33:5: note: t3332 is from here | |
| stuff.ktn:34:5: type error: cannot solve infinite type constraint t3333 = t3333 t3332 t3339 | |
| stuff.ktn:34:5: note: this may be due to a mismatched number of arguments or results | |
| stuff.ktn:34:6: note: t3333 is from here | |
| stuff.ktn:34:14: note: t3339 is from here | |
| (unknown): note: t3333 is from here | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment