comparison src/explify.sml @ 41:1405d8c26790

Beginning of functor elaboration
author Adam Chlipala <adamc@hcoop.net>
date Thu, 19 Jun 2008 16:04:28 -0400
parents d16ef24de78b
children b3fbbc6cb1e5
comparison
equal deleted inserted replaced
40:e3d3c2791105 41:1405d8c26790
90 90
91 and explifySgn (sgn, loc) = 91 and explifySgn (sgn, loc) =
92 case sgn of 92 case sgn of
93 L.SgnConst sgis => (L'.SgnConst (map explifySgi sgis), loc) 93 L.SgnConst sgis => (L'.SgnConst (map explifySgi sgis), loc)
94 | L.SgnVar n => (L'.SgnVar n, loc) 94 | L.SgnVar n => (L'.SgnVar n, loc)
95 | L.SgnFun _ => raise Fail "Explify functor signature"
95 | L.SgnError => raise Fail ("explifySgn: SgnError at " ^ EM.spanToString loc) 96 | L.SgnError => raise Fail ("explifySgn: SgnError at " ^ EM.spanToString loc)
96 97
97 fun explifyDecl (d, loc : EM.span) = 98 fun explifyDecl (d, loc : EM.span) =
98 case d of 99 case d of
99 L.DCon (x, n, k, c) => (L'.DCon (x, n, explifyKind k, explifyCon c), loc) 100 L.DCon (x, n, k, c) => (L'.DCon (x, n, explifyKind k, explifyCon c), loc)
105 and explifyStr (str, loc) = 106 and explifyStr (str, loc) =
106 case str of 107 case str of
107 L.StrConst ds => (L'.StrConst (map explifyDecl ds), loc) 108 L.StrConst ds => (L'.StrConst (map explifyDecl ds), loc)
108 | L.StrVar n => (L'.StrVar n, loc) 109 | L.StrVar n => (L'.StrVar n, loc)
109 | L.StrProj (str, s) => (L'.StrProj (explifyStr str, s), loc) 110 | L.StrProj (str, s) => (L'.StrProj (explifyStr str, s), loc)
111 | L.StrFun _ => raise Fail "Explify functor"
110 | L.StrError => raise Fail ("explifyStr: StrError at " ^ EM.spanToString loc) 112 | L.StrError => raise Fail ("explifyStr: StrError at " ^ EM.spanToString loc)
111 113
112 val explify = map explifyDecl 114 val explify = map explifyDecl
113 115
114 end 116 end