Mercurial > urweb
comparison src/corify.sml @ 626:230654093b51
demo/hello compiles with kind polymorphism
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 22 Feb 2009 17:17:01 -0500 |
parents | 588b9d16b00a |
children | 70cbdcf5989b |
comparison
equal
deleted
inserted
replaced
625:47947d6e9750 | 626:230654093b51 |
---|---|
442 | L.KName => (L'.KName, loc) | 442 | L.KName => (L'.KName, loc) |
443 | L.KRecord k => (L'.KRecord (corifyKind k), loc) | 443 | L.KRecord k => (L'.KRecord (corifyKind k), loc) |
444 | L.KUnit => (L'.KUnit, loc) | 444 | L.KUnit => (L'.KUnit, loc) |
445 | L.KTuple ks => (L'.KTuple (map corifyKind ks), loc) | 445 | L.KTuple ks => (L'.KTuple (map corifyKind ks), loc) |
446 | 446 |
447 | L.KRel n => (L'.KRel n, loc) | |
448 | L.KFun (x, k) => (L'.KFun (x, corifyKind k), loc) | |
449 | |
447 fun corifyCon st (c, loc) = | 450 fun corifyCon st (c, loc) = |
448 case c of | 451 case c of |
449 L.TFun (t1, t2) => (L'.TFun (corifyCon st t1, corifyCon st t2), loc) | 452 L.TFun (t1, t2) => (L'.TFun (corifyCon st t1, corifyCon st t2), loc) |
450 | L.TCFun (x, k, t) => (L'.TCFun (x, corifyKind k, corifyCon st t), loc) | 453 | L.TCFun (x, k, t) => (L'.TCFun (x, corifyKind k, corifyCon st t), loc) |
454 | L.TKFun (x, t) => (L'.TKFun (x, corifyCon st t), loc) | |
451 | L.TRecord c => (L'.TRecord (corifyCon st c), loc) | 455 | L.TRecord c => (L'.TRecord (corifyCon st c), loc) |
452 | 456 |
453 | L.CRel n => (L'.CRel n, loc) | 457 | L.CRel n => (L'.CRel n, loc) |
454 | L.CNamed n => | 458 | L.CNamed n => |
455 (case St.lookupConById st n of | 459 (case St.lookupConById st n of |
465 | St.CFfi m => (L'.CFfi (m, x), loc) | 469 | St.CFfi m => (L'.CFfi (m, x), loc) |
466 end | 470 end |
467 | 471 |
468 | L.CApp (c1, c2) => (L'.CApp (corifyCon st c1, corifyCon st c2), loc) | 472 | L.CApp (c1, c2) => (L'.CApp (corifyCon st c1, corifyCon st c2), loc) |
469 | L.CAbs (x, k, c) => (L'.CAbs (x, corifyKind k, corifyCon st c), loc) | 473 | L.CAbs (x, k, c) => (L'.CAbs (x, corifyKind k, corifyCon st c), loc) |
474 | |
475 | L.CKApp (c1, k) => (L'.CKApp (corifyCon st c1, corifyKind k), loc) | |
476 | L.CKAbs (x, c) => (L'.CKAbs (x, corifyCon st c), loc) | |
470 | 477 |
471 | L.CName s => (L'.CName s, loc) | 478 | L.CName s => (L'.CName s, loc) |
472 | 479 |
473 | L.CRecord (k, xcs) => | 480 | L.CRecord (k, xcs) => |
474 (L'.CRecord (corifyKind k, map (fn (c1, c2) => (corifyCon st c1, corifyCon st c2)) xcs), loc) | 481 (L'.CRecord (corifyKind k, map (fn (c1, c2) => (corifyCon st c1, corifyCon st c2)) xcs), loc) |
579 end | 586 end |
580 | L.EApp (e1, e2) => (L'.EApp (corifyExp st e1, corifyExp st e2), loc) | 587 | L.EApp (e1, e2) => (L'.EApp (corifyExp st e1, corifyExp st e2), loc) |
581 | L.EAbs (x, dom, ran, e1) => (L'.EAbs (x, corifyCon st dom, corifyCon st ran, corifyExp st e1), loc) | 588 | L.EAbs (x, dom, ran, e1) => (L'.EAbs (x, corifyCon st dom, corifyCon st ran, corifyExp st e1), loc) |
582 | L.ECApp (e1, c) => (L'.ECApp (corifyExp st e1, corifyCon st c), loc) | 589 | L.ECApp (e1, c) => (L'.ECApp (corifyExp st e1, corifyCon st c), loc) |
583 | L.ECAbs (x, k, e1) => (L'.ECAbs (x, corifyKind k, corifyExp st e1), loc) | 590 | L.ECAbs (x, k, e1) => (L'.ECAbs (x, corifyKind k, corifyExp st e1), loc) |
591 | L.EKApp (e1, k) => (L'.EKApp (corifyExp st e1, corifyKind k), loc) | |
592 | L.EKAbs (x, e1) => (L'.EKAbs (x, corifyExp st e1), loc) | |
584 | 593 |
585 | L.ERecord xes => (L'.ERecord (map (fn (c, e, t) => | 594 | L.ERecord xes => (L'.ERecord (map (fn (c, e, t) => |
586 (corifyCon st c, corifyExp st e, corifyCon st t)) xes), loc) | 595 (corifyCon st c, corifyExp st e, corifyCon st t)) xes), loc) |
587 | L.EField (e1, c, {field, rest}) => (L'.EField (corifyExp st e1, corifyCon st c, | 596 | L.EField (e1, c, {field, rest}) => (L'.EField (corifyExp st e1, corifyCon st c, |
588 {field = corifyCon st field, rest = corifyCon st rest}), loc) | 597 {field = corifyCon st field, rest = corifyCon st rest}), loc) |