comparison src/explify.sml @ 76:522f4bd3955e

Broaden unification context
author Adam Chlipala <adamc@hcoop.net>
date Sun, 29 Jun 2008 10:39:43 -0400
parents 0ee10f4d73cf
children b4f2a258e52c
comparison
equal deleted inserted replaced
75:88ffb3d61817 76:522f4bd3955e
37 | L.KArrow (k1, k2) => (L'.KArrow (explifyKind k1, explifyKind k2), loc) 37 | L.KArrow (k1, k2) => (L'.KArrow (explifyKind k1, explifyKind k2), loc)
38 | L.KName => (L'.KName, loc) 38 | L.KName => (L'.KName, loc)
39 | L.KRecord k => (L'.KRecord (explifyKind k), loc) 39 | L.KRecord k => (L'.KRecord (explifyKind k), loc)
40 40
41 | L.KError => raise Fail ("explifyKind: KError at " ^ EM.spanToString loc) 41 | L.KError => raise Fail ("explifyKind: KError at " ^ EM.spanToString loc)
42 | L.KUnif (_, ref (SOME k)) => explifyKind k 42 | L.KUnif (_, _, ref (SOME k)) => explifyKind k
43 | L.KUnif _ => raise Fail ("explifyKind: KUnif at " ^ EM.spanToString loc) 43 | L.KUnif _ => raise Fail ("explifyKind: KUnif at " ^ EM.spanToString loc)
44 44
45 fun explifyCon (c, loc) = 45 fun explifyCon (c, loc) =
46 case c of 46 case c of
47 L.TFun (t1, t2) => (L'.TFun (explifyCon t1, explifyCon t2), loc) 47 L.TFun (t1, t2) => (L'.TFun (explifyCon t1, explifyCon t2), loc)
60 | L.CRecord (k, xcs) => (L'.CRecord (explifyKind k, map (fn (c1, c2) => (explifyCon c1, explifyCon c2)) xcs), loc) 60 | L.CRecord (k, xcs) => (L'.CRecord (explifyKind k, map (fn (c1, c2) => (explifyCon c1, explifyCon c2)) xcs), loc)
61 | L.CConcat (c1, c2) => (L'.CConcat (explifyCon c1, explifyCon c2), loc) 61 | L.CConcat (c1, c2) => (L'.CConcat (explifyCon c1, explifyCon c2), loc)
62 | L.CFold (dom, ran) => (L'.CFold (explifyKind dom, explifyKind ran), loc) 62 | L.CFold (dom, ran) => (L'.CFold (explifyKind dom, explifyKind ran), loc)
63 63
64 | L.CError => raise Fail ("explifyCon: CError at " ^ EM.spanToString loc) 64 | L.CError => raise Fail ("explifyCon: CError at " ^ EM.spanToString loc)
65 | L.CUnif (_, _, ref (SOME c)) => explifyCon c 65 | L.CUnif (_, _, _, ref (SOME c)) => explifyCon c
66 | L.CUnif _ => raise Fail ("explifyCon: CUnif at " ^ EM.spanToString loc) 66 | L.CUnif _ => raise Fail ("explifyCon: CUnif at " ^ EM.spanToString loc)
67 67
68 fun explifyExp (e, loc) = 68 fun explifyExp (e, loc) =
69 case e of 69 case e of
70 L.EPrim p => (L'.EPrim p, loc) 70 L.EPrim p => (L'.EPrim p, loc)