invalidated former constructors None/OPTION to prevent accidental use as match-all patterns!
authorwenzelm
Thu, 07 Apr 2005 09:27:33 +0200
changeset 15670 963cd3f7976c
parent 15669 2b1f1902505d
child 15671 8df681866dc9
invalidated former constructors None/OPTION to prevent accidental use as match-all patterns!
src/Pure/library.ML
--- a/src/Pure/library.ML	Thu Apr 07 09:27:20 2005 +0200
+++ b/src/Pure/library.ML	Thu Apr 07 09:27:33 2005 +0200
@@ -37,6 +37,11 @@
 
   (*options*)
   val is_none: 'a option -> bool
+
+  (*old options -- invalidated*)
+  datatype invalid = None of invalid
+  exception OPTION of invalid
+
   exception ERROR
   val try: ('a -> 'b) -> 'a -> 'b option
   val can: ('a -> 'b) -> 'a -> bool
@@ -317,15 +322,14 @@
 (** options **)
 
 val the = valOf;
-
-(*strict!*)
-fun if_none opt a = getOpt(opt,a);
-
+fun if_none opt a = getOpt (opt, a);
 val is_some = isSome;
+fun is_none opt = not (isSome opt);
+val apsome = Option.map;
 
-fun is_none opt = not (isSome opt);
-
-val apsome = Option.map;
+(*invalidate former constructors to prevent accidental use as match-all patterns!*)
+datatype invalid = None of invalid;
+exception OPTION of invalid;
 
 
 (* exception handling *)
@@ -586,9 +590,7 @@
 
 (*copy the list preserving elements that satisfy the predicate*)
 val filter = List.filter;
-
 fun filter_out f = filter (not o f);
-
 val mapfilter = List.mapPartial;