comparison src/corify.sml @ 213:0343557355fc

Explifying type classes
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 14:45:23 -0400
parents ab86aa858e6c
children 766b5475477f
comparison
equal deleted inserted replaced
212:ba4d7c33a45f 213:0343557355fc
378 L.KType => (L'.KType, loc) 378 L.KType => (L'.KType, loc)
379 | L.KArrow (k1, k2) => (L'.KArrow (corifyKind k1, corifyKind k2), loc) 379 | L.KArrow (k1, k2) => (L'.KArrow (corifyKind k1, corifyKind k2), loc)
380 | L.KName => (L'.KName, loc) 380 | L.KName => (L'.KName, loc)
381 | L.KRecord k => (L'.KRecord (corifyKind k), loc) 381 | L.KRecord k => (L'.KRecord (corifyKind k), loc)
382 | L.KUnit => (L'.KUnit, loc) 382 | L.KUnit => (L'.KUnit, loc)
383 | L.KTuple _ => raise Fail "Corify KTuple"
383 384
384 fun corifyCon st (c, loc) = 385 fun corifyCon st (c, loc) =
385 case c of 386 case c of
386 L.TFun (t1, t2) => (L'.TFun (corifyCon st t1, corifyCon st t2), loc) 387 L.TFun (t1, t2) => (L'.TFun (corifyCon st t1, corifyCon st t2), loc)
387 | L.TCFun (x, k, t) => (L'.TCFun (x, corifyKind k, corifyCon st t), loc) 388 | L.TCFun (x, k, t) => (L'.TCFun (x, corifyKind k, corifyCon st t), loc)
410 | L.CRecord (k, xcs) => 411 | L.CRecord (k, xcs) =>
411 (L'.CRecord (corifyKind k, map (fn (c1, c2) => (corifyCon st c1, corifyCon st c2)) xcs), loc) 412 (L'.CRecord (corifyKind k, map (fn (c1, c2) => (corifyCon st c1, corifyCon st c2)) xcs), loc)
412 | L.CConcat (c1, c2) => (L'.CConcat (corifyCon st c1, corifyCon st c2), loc) 413 | L.CConcat (c1, c2) => (L'.CConcat (corifyCon st c1, corifyCon st c2), loc)
413 | L.CFold (k1, k2) => (L'.CFold (corifyKind k1, corifyKind k2), loc) 414 | L.CFold (k1, k2) => (L'.CFold (corifyKind k1, corifyKind k2), loc)
414 | L.CUnit => (L'.CUnit, loc) 415 | L.CUnit => (L'.CUnit, loc)
416
417 | L.CTuple _ => raise Fail "Corify CTuple"
418 | L.CProj _ => raise Fail "Corify CProj"
415 419
416 fun corifyPatCon st pc = 420 fun corifyPatCon st pc =
417 case pc of 421 case pc of
418 L.PConVar n => St.lookupConstructorById st n 422 L.PConVar n => St.lookupConstructorById st n
419 | L.PConProj (m1, ms, x) => 423 | L.PConProj (m1, ms, x) =>