Mercurial > urweb
diff src/explify.sml @ 162:06a98129b23f
Add datatype import constructor annotations; datatypes through explify
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 29 Jul 2008 12:30:04 -0400 |
parents | 34ccd7d2bea8 |
children | c7a6e6dbc318 |
line wrap: on
line diff
--- a/src/explify.sml Thu Jul 24 16:51:24 2008 -0400 +++ b/src/explify.sml Tue Jul 29 12:30:04 2008 -0400 @@ -95,8 +95,11 @@ case sgi of L.SgiConAbs (x, n, k) => SOME (L'.SgiConAbs (x, n, explifyKind k), loc) | L.SgiCon (x, n, k, c) => SOME (L'.SgiCon (x, n, explifyKind k, explifyCon c), loc) - | L.SgiDatatype _ => raise Fail "Explify SgiDatatype" - | L.SgiDatatypeImp _ => raise Fail "Explify SgiDatatypeImp" + | L.SgiDatatype (x, n, xncs) => SOME (L'.SgiDatatype (x, n, map (fn (x, n, co) => + (x, n, Option.map explifyCon co)) xncs), loc) + | L.SgiDatatypeImp (x, n, m1, ms, s, xncs) => + SOME (L'.SgiDatatypeImp (x, n, m1, ms, s, map (fn (x, n, co) => + (x, n, Option.map explifyCon co)) xncs), loc) | L.SgiVal (x, n, c) => SOME (L'.SgiVal (x, n, explifyCon c), loc) | L.SgiStr (x, n, sgn) => SOME (L'.SgiStr (x, n, explifySgn sgn), loc) | L.SgiSgn (x, n, sgn) => SOME (L'.SgiSgn (x, n, explifySgn sgn), loc) @@ -114,8 +117,11 @@ fun explifyDecl (d, loc : EM.span) = case d of L.DCon (x, n, k, c) => SOME (L'.DCon (x, n, explifyKind k, explifyCon c), loc) - | L.DDatatype _ => raise Fail "Explify DDatatype" - | L.DDatatypeImp _ => raise Fail "Explify DDatatypeImp" + | L.DDatatype (x, n, xncs) => SOME (L'.DDatatype (x, n, map (fn (x, n, co) => + (x, n, Option.map explifyCon co)) xncs), loc) + | L.DDatatypeImp (x, n, m1, ms, s, xncs) => + SOME (L'.DDatatypeImp (x, n, m1, ms, s, map (fn (x, n, co) => + (x, n, Option.map explifyCon co)) xncs), loc) | L.DVal (x, n, t, e) => SOME (L'.DVal (x, n, explifyCon t, explifyExp e), loc) | L.DValRec vis => SOME (L'.DValRec (map (fn (x, n, t, e) => (x, n, explifyCon t, explifyExp e)) vis), loc)