[MLton-commit] r5869
Vesa Karvonen
vesak at mlton.org
Mon Aug 13 23:46:33 PDT 2007
Added type ascriptions to eliminate SML/NJ's "calling polyEqual" warnings.
Added a note on specializing equality.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml
U mltonlib/trunk/com/ssh/generic/unstable/public/value/eq.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml 2007-08-14 06:25:33 UTC (rev 5868)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml 2007-08-14 06:46:33 UTC (rev 5869)
@@ -47,7 +47,7 @@
val record = id
val op +` = Sum.equal
- val unit = op =
+ val unit = op = : Unit.t Rep.t
fun C0 _ = unit
fun C1 _ = id
val data = id
@@ -70,23 +70,23 @@
fun vector ? = seq Vector.length Vector.sub ?
- fun array _ = op =
- fun refc _ = op =
+ fun array _ = op = : 'a Array.t Rep.t
+ fun refc _ = op = : 'a Ref.t Rep.t
- val largeInt = op =
+ val largeInt = op = : LargeInt.t Rep.t
val largeReal = iso op = CastLargeReal.isoBits
- val largeWord = op =
+ val largeWord = op = : LargeWord.t Rep.t
- val bool = op =
- val char = op =
- val int = op =
+ val bool = op = : Bool.t Rep.t
+ val char = op = : Char.t Rep.t
+ val int = op = : Int.t Rep.t
val real = iso op = CastReal.isoBits
- val string = op =
- val word = op =
+ val string = op = : String.t Rep.t
+ val word = op = : Word.t Rep.t
- val word8 = op =
- val word32 = op =
- val word64 = op =)
+ val word8 = op = : Word8.t Rep.t
+ val word32 = op = : Word32.t Rep.t
+ val word64 = op = : Word64.t Rep.t)
open Layered
end
Modified: mltonlib/trunk/com/ssh/generic/unstable/public/value/eq.sig
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/public/value/eq.sig 2007-08-14 06:25:33 UTC (rev 5868)
+++ mltonlib/trunk/com/ssh/generic/unstable/public/value/eq.sig 2007-08-14 06:46:33 UTC (rev 5869)
@@ -27,9 +27,9 @@
* constructor and the arguments of the constructors are considered equal.
* Of course, all of this is modulo user specified morphisms!
*
- * Comparison of exceptions only works when at least one of the exception
- * constructors involved in a comparison has been registered with
- * {regExn}.
+ * By default, comparison of exceptions only works when at least one of
+ * the exception constructors involved in a comparison has been registered
+ * with {regExn}.
*
* Comparison of functions is impossible and fails at run-time.
*)
@@ -37,13 +37,21 @@
structure Eq : OPEN_REP
val eq : ('a, 'x) Eq.t -> 'a BinPr.t
- (** Extracts the equality relation. *)
+ (** Extracts the equality predicate. *)
val notEq : ('a, 'x) Eq.t -> 'a BinPr.t
(** {notEq t = not o eq t} *)
val withEq : 'a BinPr.t -> ('a, 'x) Eq.t UnOp.t
- (** Functionally updates the equality predicate. *)
+ (**
+ * Functionally updates the equality predicate.
+ *
+ * Note that specializing equality often means that several other
+ * generic functions need to be specialized as well. In particular,
+ * generic hashing and ordering should generally respect equality.
+ * Instead of specializing equality, consider using a canonic data
+ * representation where each equivalence class is a singleton.
+ *)
end
signature EQ_CASES = sig
More information about the MLton-commit
mailing list