From 09b5839acfe26561fa87c89168133fc93c1083cc Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 7 Jan 2012 15:56:22 -0500 Subject: First part of changes to avoid depending on C function call argument order of evaluation (omitting normal Ur function calls, so far) --- src/core_util.sml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/core_util.sml') diff --git a/src/core_util.sml b/src/core_util.sml index e71d7276..d41dfe33 100644 --- a/src/core_util.sml +++ b/src/core_util.sml @@ -468,7 +468,7 @@ fun compare ((e1, _), (e2, _)) = | (EFfiApp (f1, x1, es1), EFfiApp (f2, x2, es2)) => join (String.compare (f1, f2), fn () => join (String.compare (x1, x2), - fn () => joinL compare (es1, es2))) + fn () => joinL (fn ((e1, _), (e2, _)) => compare (e1, e2))(es1, es2))) | (EFfiApp _, _) => LESS | (_, EFfiApp _) => GREATER @@ -586,6 +586,12 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, bind} = fun mfe ctx e acc = S.bindP (mfe' ctx e acc, fe ctx) + and mfet ctx (e, t) = + S.bind2 (mfe ctx e, + fn e' => + S.map2 (mfc ctx t, + fn t' => (e', t'))) + and mfe' ctx (eAll as (e, loc)) = case e of EPrim _ => S.return2 eAll @@ -603,7 +609,7 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, bind} = (ECon (dk, n, cs', SOME e'), loc))) | EFfi _ => S.return2 eAll | EFfiApp (m, x, es) => - S.map2 (ListUtil.mapfold (mfe ctx) es, + S.map2 (ListUtil.mapfold (mfet ctx) es, fn es' => (EFfiApp (m, x, es'), loc)) | EApp (e1, e2) => -- cgit v1.2.3