diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-08-03 19:49:21 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-08-03 19:49:21 -0400 |
commit | 744cdbb9e3907db9bb01576750634c614147e1a3 (patch) | |
tree | aecef31d4055d34a31977834cbda020811d1dfab /src/core_util.sml | |
parent | 9a9f1738a8eae9df07f97da224cd9cf45033e9dc (diff) |
Datatype representation optimization
Diffstat (limited to 'src/core_util.sml')
-rw-r--r-- | src/core_util.sml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core_util.sml b/src/core_util.sml index 1cc25e37..6c790437 100644 --- a/src/core_util.sml +++ b/src/core_util.sml @@ -29,6 +29,12 @@ structure CoreUtil :> CORE_UTIL = struct open Core +fun classifyDatatype xncs = + if List.all (fn (_, _, NONE) => true | _ => false) xncs then + Enum + else + Default + structure S = Search structure Kind = struct @@ -227,11 +233,11 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, bind} = EPrim _ => S.return2 eAll | ERel _ => S.return2 eAll | ENamed _ => S.return2 eAll - | ECon (_, NONE) => S.return2 eAll - | ECon (n, SOME e) => + | ECon (_, _, NONE) => S.return2 eAll + | ECon (dk, n, SOME e) => S.map2 (mfe ctx e, fn e' => - (ECon (n, SOME e'), loc)) + (ECon (dk, n, SOME e'), loc)) | EFfi _ => S.return2 eAll | EFfiApp (m, x, es) => S.map2 (ListUtil.mapfold (fn e => mfe ctx e) es, |