Last active
December 12, 2015 09:28
-
-
Save lazyval/4751462 to your computer and use it in GitHub Desktop.
SML code that leads to type inference fail.
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
| fun all_answers func [] = SOME [] | |
| fun all_answers func xs = let | |
| fun loop [] = [] | |
| | loop (h::tail) = case (func h) of | |
| SOME x => x :: loop tail | |
| | NONE => loop tail | |
| in case loop xs of | |
| [] => NONE | |
| | lst => SOME lst | |
| end | |
| (* | |
| val test = all_answers (fn x => x) [] | |
| evaluates to dummy types: | |
| val test = NONE : ?.X1 list option | |
| *) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment