[MLton-commit] r5623
Vesa Karvonen
vesak at mlton.org
Thu Jun 14 20:54:58 PDT 2007
"Pure" is not relevant in product and sum indices.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/generic/unstable/detail/value/type-info.sml
U mltonlib/trunk/com/ssh/generic/unstable/public/value/type-info.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/type-info.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/type-info.sml 2007-06-14 22:31:23 UTC (rev 5622)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/type-info.sml 2007-06-15 03:54:58 UTC (rev 5623)
@@ -28,14 +28,12 @@
INS of {alts : Int.t,
base : Bool.t,
exn : Bool.t,
- pure : Bool.t,
recs : Int.t List.t}
datatype p =
INP of {base : Bool.t,
elems : Int.t,
exn : Bool.t,
- pure : Bool.t,
recs : Int.t List.t}
fun revMerge (xs, ys) = let
@@ -81,12 +79,12 @@
fun (INP {base = bl, elems = el, exn = hl, recs = rl, ...}) *`
(INP {base = br, elems = er, exn = hr, recs = rr, ...}) =
INP {base = bl andalso br, elems = el + er, exn = hl orelse hr,
- pure = true, recs = merge (rl, rr)}
+ recs = merge (rl, rr)}
fun (INS {alts = al, base = bl, exn = hl, recs = rl, ...}) +`
(INS {alts = ar, base = br, exn = hr, recs = rr, ...}) =
INS {alts = al + ar, base = bl orelse br, exn = hl orelse hr,
- pure = true, recs = merge (rl, rr)}
+ recs = merge (rl, rr)}
val unit = base
@@ -138,19 +136,19 @@
(* Trivialities *)
- fun T (INT {base, exn, pure, recs}) =
- INP {base = base, elems = 1, exn = exn, pure = pure, recs = recs}
+ fun T (INT {base, exn, recs, ...}) =
+ INP {base = base, elems = 1, exn = exn, recs = recs}
fun R _ = T
- fun tuple (INP {base, exn, pure, recs, ...}) =
- INT {base = base, exn = exn, pure = pure, recs = recs}
+ fun tuple (INP {base, exn, recs, ...}) =
+ INT {base = base, exn = exn, pure = true, recs = recs}
val record = tuple
- fun C0 _ = INS {alts = 1, base = true, exn = false, pure = true, recs = []}
- fun C1 _ (INT {base, exn, pure, recs}) =
- INS {alts = 1, base = base, exn = exn, pure = pure, recs = recs}
- fun data (INS {base, exn, pure, recs, ...}) =
- INT {base = base, exn = exn, pure = pure, recs = recs})
+ fun C0 _ = INS {alts = 1, base = true, exn = false, recs = []}
+ fun C1 _ (INT {base, exn, recs, ...}) =
+ INS {alts = 1, base = base, exn = exn, recs = recs}
+ fun data (INS {base, exn, recs, ...}) =
+ INT {base = base, exn = exn, pure = true, recs = recs})
open Opened
Modified: mltonlib/trunk/com/ssh/generic/unstable/public/value/type-info.sig
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/public/value/type-info.sig 2007-06-14 22:31:23 UTC (rev 5622)
+++ mltonlib/trunk/com/ssh/generic/unstable/public/value/type-info.sig 2007-06-15 03:54:58 UTC (rev 5623)
@@ -21,6 +21,8 @@
signature TYPE_INFO = sig
structure TypeInfo : OPEN_GENERIC_REP
+ (** == Types == *)
+
val canBeCyclic : ('a, 'x) TypeInfo.t UnPr.t
(**
* Returns true iff {'a} is of the form {'b ref} or {'b array} and
@@ -29,9 +31,6 @@
* Note: Functions are not considered to form cycles.
*)
- val hasBaseCase : ('a, 'x) TypeInfo.s UnPr.t
- (** Returns true iff the type {'a} has a non-recursive variant. *)
-
val hasExn : ('a, 'x) TypeInfo.t UnPr.t
(** Returns true iff the type {'a} contains the type {exn}. *)
@@ -47,9 +46,16 @@
* the form {'b ref}.
*)
+ (** == Sums == *)
+
+ val hasBaseCase : ('a, 'x) TypeInfo.s UnPr.t
+ (** Returns true iff the type {'a} has a non-recursive variant. *)
+
val numAlts : ('a, 'x) TypeInfo.s -> Int.t
(** Number of alternatives in the given incomplete sum. *)
+ (** == Products == *)
+
val numElems : ('a, 'k, 'x) TypeInfo.p -> Int.t
(** Number of elements in the given incomplete product. *)
end
More information about the MLton-commit
mailing list