comparison src/elaborate.sml @ 213:0343557355fc

Explifying type classes
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 14:45:23 -0400
parents e86411f647c6
children 38b299373676
comparison
equal deleted inserted replaced
212:ba4d7c33a45f 213:0343557355fc
2233 | L'.DStr (x, n, sgn, _) => [(L'.SgiStr (x, n, sgn), loc)] 2233 | L'.DStr (x, n, sgn, _) => [(L'.SgiStr (x, n, sgn), loc)]
2234 | L'.DFfiStr (x, n, sgn) => [(L'.SgiStr (x, n, sgn), loc)] 2234 | L'.DFfiStr (x, n, sgn) => [(L'.SgiStr (x, n, sgn), loc)]
2235 | L'.DConstraint cs => [(L'.SgiConstraint cs, loc)] 2235 | L'.DConstraint cs => [(L'.SgiConstraint cs, loc)]
2236 | L'.DExport _ => [] 2236 | L'.DExport _ => []
2237 | L'.DTable (tn, x, n, c) => [(L'.SgiTable (tn, x, n, c), loc)] 2237 | L'.DTable (tn, x, n, c) => [(L'.SgiTable (tn, x, n, c), loc)]
2238 | L'.DClass (x, n, c) => [(L'.SgiClass (x, n, c), loc)]
2238 2239
2239 fun sgiBindsD (env, denv) (sgi, _) = 2240 fun sgiBindsD (env, denv) (sgi, _) =
2240 case sgi of 2241 case sgi of
2241 L'.SgiConstraint (c1, c2) => 2242 L'.SgiConstraint (c1, c2) =>
2242 (case D.assert env denv (c1, c2) of 2243 (case D.assert env denv (c1, c2) of
2939 val (c', ck, gs) = elabCon (env, denv) c 2940 val (c', ck, gs) = elabCon (env, denv) c
2940 val (env, n) = E.pushCNamed env x k (SOME c') 2941 val (env, n) = E.pushCNamed env x k (SOME c')
2941 val env = E.pushClass env n 2942 val env = E.pushClass env n
2942 in 2943 in
2943 checkKind env c' ck k; 2944 checkKind env c' ck k;
2944 ([(L'.DCon (x, n, k, c'), loc)], (env, denv, [])) 2945 ([(L'.DClass (x, n, c'), loc)], (env, denv, []))
2945 end 2946 end
2946 2947
2947 and elabStr (env, denv) (str, loc) = 2948 and elabStr (env, denv) (str, loc) =
2948 case str of 2949 case str of
2949 L.StrConst ds => 2950 L.StrConst ds =>