Mercurial > urweb
comparison src/monoize.sml @ 290:df00701f2323
'read' type class
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 07 Sep 2008 11:53:30 -0400 |
parents | 4260ad920c36 |
children | 6e665c7c96f6 |
comparison
equal
deleted
inserted
replaced
289:0cc956a3216f | 290:df00701f2323 |
---|---|
83 | L.CApp ((L.CFfi ("Basis", "option"), _), t) => | 83 | L.CApp ((L.CFfi ("Basis", "option"), _), t) => |
84 (L'.TOption (mt env dtmap t), loc) | 84 (L'.TOption (mt env dtmap t), loc) |
85 | 85 |
86 | L.CApp ((L.CFfi ("Basis", "show"), _), t) => | 86 | L.CApp ((L.CFfi ("Basis", "show"), _), t) => |
87 (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc) | 87 (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc) |
88 | L.CApp ((L.CFfi ("Basis", "read"), _), t) => | |
89 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), | |
90 (L'.TOption (mt env dtmap t), loc)), loc) | |
88 | 91 |
89 | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "xml"), _), _), _), _), _), _) => | 92 | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "xml"), _), _), _), _), _), _) => |
90 (L'.TFfi ("Basis", "string"), loc) | 93 (L'.TFfi ("Basis", "string"), loc) |
91 | L.CApp ((L.CApp ((L.CFfi ("Basis", "xhtml"), _), _), _), _) => | 94 | L.CApp ((L.CApp ((L.CFfi ("Basis", "xhtml"), _), _), _), _) => |
92 (L'.TFfi ("Basis", "string"), loc) | 95 (L'.TFfi ("Basis", "string"), loc) |
487 in | 490 in |
488 ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm) | 491 ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm) |
489 end | 492 end |
490 | L.EFfi ("Basis", "show_bool") => | 493 | L.EFfi ("Basis", "show_bool") => |
491 ((L'.EFfi ("Basis", "boolToString"), loc), fm) | 494 ((L'.EFfi ("Basis", "boolToString"), loc), fm) |
495 | |
496 | L.ECApp ((L.EFfi ("Basis", "read"), _), t) => | |
497 let | |
498 val t = monoType env t | |
499 val s = (L'.TFfi ("Basis", "string"), loc) | |
500 in | |
501 ((L'.EAbs ("f", (L'.TFun (t, s), loc), (L'.TFun (t, s), loc), | |
502 (L'.ERel 0, loc)), loc), fm) | |
503 end | |
504 | L.EFfi ("Basis", "read_int") => | |
505 ((L'.EFfi ("Basis", "stringToInt"), loc), fm) | |
506 | L.EFfi ("Basis", "read_float") => | |
507 ((L'.EFfi ("Basis", "stringToFloat"), loc), fm) | |
508 | L.EFfi ("Basis", "read_string") => | |
509 let | |
510 val s = (L'.TFfi ("Basis", "string"), loc) | |
511 in | |
512 ((L'.EAbs ("s", s, (L'.TOption s, loc), | |
513 (L'.ESome (s, (L'.ERel 0, loc)), loc)), loc), fm) | |
514 end | |
515 | L.EFfi ("Basis", "read_bool") => | |
516 ((L'.EFfi ("Basis", "stringToBool"), loc), fm) | |
492 | 517 |
493 | L.ECApp ((L.EFfi ("Basis", "return"), _), t) => | 518 | L.ECApp ((L.EFfi ("Basis", "return"), _), t) => |
494 let | 519 let |
495 val t = monoType env t | 520 val t = monoType env t |
496 in | 521 in |