Mercurial > urweb
diff src/monoize.sml @ 164:6847741e1f5f
Datatypes through monoize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 29 Jul 2008 13:32:07 -0400 |
parents | 80192edca30d |
children | 2be573fec9a6 |
line wrap: on
line diff
--- a/src/monoize.sml Tue Jul 29 13:16:21 2008 -0400 +++ b/src/monoize.sml Tue Jul 29 13:32:07 2008 -0400 @@ -115,6 +115,8 @@ | L'.TFfi ("Basis", "float") => (L'.EFfiApp ("Basis", name ^ "ifyFloat", [e]), loc) | L'.TRecord [] => (L'.EPrim (Prim.String ""), loc) + | L'.TNamed _ => (L'.EPrim (Prim.String ""), loc) + | _ => (E.errorAt loc "Don't know how to encode attribute type"; Print.eprefaces' [("Type", MonoPrint.p_typ MonoEnv.empty tAll)]; dummyExp) @@ -453,7 +455,12 @@ in case d of L.DCon _ => NONE - | L.DDatatype _ => raise Fail "Monoize DDatatype" + | L.DDatatype (x, n, xncs) => + let + val d = (L'.DDatatype (x, n, map (fn (x, n, to) => (x, n, Option.map (monoType env) to)) xncs), loc) + in + SOME (Env.declBinds env all, d) + end | L.DVal (x, n, t, e, s) => SOME (Env.pushENamed env x n t (SOME e) s, (L'.DVal (x, n, monoType env t, monoExp (env, St.empty) e, s), loc)) | L.DValRec vis =>