comparison src/corify.sml @ 214:766b5475477f

Corifying con-tuples
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 15:03:05 -0400
parents 0343557355fc
children 3aa010e97db9
comparison
equal deleted inserted replaced
213:0343557355fc 214:766b5475477f
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 | L.KTuple ks => (L'.KTuple (map corifyKind ks), loc)
384 384
385 fun corifyCon st (c, loc) = 385 fun corifyCon st (c, loc) =
386 case c of 386 case c of
387 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)
388 | 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)
412 (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)
413 | 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)
414 | L.CFold (k1, k2) => (L'.CFold (corifyKind k1, corifyKind k2), loc) 414 | L.CFold (k1, k2) => (L'.CFold (corifyKind k1, corifyKind k2), loc)
415 | L.CUnit => (L'.CUnit, loc) 415 | L.CUnit => (L'.CUnit, loc)
416 416
417 | L.CTuple _ => raise Fail "Corify CTuple" 417 | L.CTuple cs => (L'.CTuple (map (corifyCon st) cs), loc)
418 | L.CProj _ => raise Fail "Corify CProj" 418 | L.CProj (c, n) => (L'.CProj (corifyCon st c, n), loc)
419 419
420 fun corifyPatCon st pc = 420 fun corifyPatCon st pc =
421 case pc of 421 case pc of
422 L.PConVar n => St.lookupConstructorById st n 422 L.PConVar n => St.lookupConstructorById st n
423 | L.PConProj (m1, ms, x) => 423 | L.PConProj (m1, ms, x) =>