Skip to content

Instantly share code, notes, and snippets.

@lazyval
Last active December 12, 2015 09:28
Show Gist options
  • Select an option

  • Save lazyval/4751462 to your computer and use it in GitHub Desktop.

Select an option

Save lazyval/4751462 to your computer and use it in GitHub Desktop.
SML code that leads to type inference fail.
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