Mercurial > urweb
comparison src/mono_util.sml @ 568:55fc747a67dc
Initial <dyn> support
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 20 Dec 2008 15:46:48 -0500 |
parents | 1901db85acb4 |
children | 162d5308e34f |
comparison
equal
deleted
inserted
replaced
567:1901db85acb4 | 568:55fc747a67dc |
---|---|
49 joinL compareFields (xts1, xts2) | 49 joinL compareFields (xts1, xts2) |
50 end | 50 end |
51 | (TDatatype (n1, _), TDatatype (n2, _)) => Int.compare (n1, n2) | 51 | (TDatatype (n1, _), TDatatype (n2, _)) => Int.compare (n1, n2) |
52 | (TFfi (m1, x1), TFfi (m2, x2)) => join (String.compare (m1, m2), fn () => String.compare (x1, x2)) | 52 | (TFfi (m1, x1), TFfi (m2, x2)) => join (String.compare (m1, m2), fn () => String.compare (x1, x2)) |
53 | (TOption t1, TOption t2) => compare (t1, t2) | 53 | (TOption t1, TOption t2) => compare (t1, t2) |
54 | (TSignal t1, TSignal t2) => compare (t1, t2) | |
54 | 55 |
55 | (TFun _, _) => LESS | 56 | (TFun _, _) => LESS |
56 | (_, TFun _) => GREATER | 57 | (_, TFun _) => GREATER |
57 | 58 |
58 | (TRecord _, _) => LESS | 59 | (TRecord _, _) => LESS |
61 | (TDatatype _, _) => LESS | 62 | (TDatatype _, _) => LESS |
62 | (_, TDatatype _) => GREATER | 63 | (_, TDatatype _) => GREATER |
63 | 64 |
64 | (TFfi _, _) => LESS | 65 | (TFfi _, _) => LESS |
65 | (_, TFfi _) => GREATER | 66 | (_, TFfi _) => GREATER |
67 | |
68 | (TOption _, _) => LESS | |
69 | (_, TOption _) => GREATER | |
66 | 70 |
67 and compareFields ((x1, t1), (x2, t2)) = | 71 and compareFields ((x1, t1), (x2, t2)) = |
68 join (String.compare (x1, x2), | 72 join (String.compare (x1, x2), |
69 fn () => compare (t1, t2)) | 73 fn () => compare (t1, t2)) |
70 | 74 |
94 | TFfi _ => S.return2 cAll | 98 | TFfi _ => S.return2 cAll |
95 | TOption t => | 99 | TOption t => |
96 S.map2 (mft t, | 100 S.map2 (mft t, |
97 fn t' => | 101 fn t' => |
98 (TOption t, loc)) | 102 (TOption t, loc)) |
103 | TSignal t => | |
104 S.map2 (mft t, | |
105 fn t' => | |
106 (TSignal t, loc)) | |
99 in | 107 in |
100 mft | 108 mft |
101 end | 109 end |
102 | 110 |
103 fun map typ c = | 111 fun map typ c = |
309 S.bind2 (mfe ctx e, | 317 S.bind2 (mfe ctx e, |
310 fn e' => | 318 fn e' => |
311 S.map2 (mft t, | 319 S.map2 (mft t, |
312 fn t' => | 320 fn t' => |
313 (EUnurlify (e', t'), loc))) | 321 (EUnurlify (e', t'), loc))) |
314 | EJavaScript e => | 322 | EJavaScript (m, e) => |
315 S.map2 (mfe ctx e, | 323 S.map2 (mfe ctx e, |
316 fn e' => | 324 fn e' => |
317 (EJavaScript e', loc)) | 325 (EJavaScript (m, e'), loc)) |
326 | ESignalReturn e => | |
327 S.map2 (mfe ctx e, | |
328 fn e' => | |
329 (ESignalReturn e', loc)) | |
318 in | 330 in |
319 mfe | 331 mfe |
320 end | 332 end |
321 | 333 |
322 fun mapfold {typ = fc, exp = fe} = | 334 fun mapfold {typ = fc, exp = fe} = |