Created
April 6, 2015 22:57
-
-
Save ryanmr/5f65022e5fd3e3a28db6 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
(* | |
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