Skip to content

Instantly share code, notes, and snippets.

@ryanmr
Created April 6, 2015 22:57
Show Gist options
  • Save ryanmr/5f65022e5fd3e3a28db6 to your computer and use it in GitHub Desktop.
Save ryanmr/5f65022e5fd3e3a28db6 to your computer and use it in GitHub Desktop.
(*
What I hate about SML; parathensis are optional sometimes and absolutely required other times,
and currying is possible, so you never know what you want.
*)
| tExp(A.RecordExp {fields, typ, pos}) =
let
val typ' = (case Symbol.look(tenv, typ) of
SOME(t) => actual_type(t, pos)
| _ => (report pos (E.UndeclaredType (Symbol.name typ)) "undeclared type for record"; (E.ERROR))
)
val tnames = map #1 fields
(* Parenthesis required around the ListPair argument. *)
(* val ttys = map (fn (e,p) => (actual_type(tExp e, p))) ListPair.zip(map #2 fields, map #3 fields) *)
val ttys = map (fn (e,p) => (actual_type(tExp e, p))) (ListPair.zip(map #2 fields, map #3 fields))
in
(case typ' of
E.RECORD(symbol, ty) =>
let
in
E.ERROR
end
| _ => (report pos (E.IncorrectType (typ')) "expected record type"; (E.ERROR))
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment