src/Pure/basis.ML
author wenzelm
Mon, 09 Nov 1998 15:42:08 +0100
changeset 5840 e2d2b896c717
parent 5836 90f7d9f1a0cc
child 11852 a528a716a312
permissions -rw-r--r--
Object logic specific operations.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2402
b3d273ce5601 fixed comments;
wenzelm
parents: 2265
diff changeset
     1
(*  Title:      Pure/basis.ML
2217
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
     2
    ID:         $Id$
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
     5
5021
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
     6
Basis Library emulation.  Needed for Poly/ML and Standard ML of New
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
     7
Jersey version 0.93 to 1.08.  Full compatibility cannot be obtained
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
     8
using a file: what about char constants?
2217
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
     9
*)
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    10
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    11
exception Subscript;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    12
2230
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    13
structure Bool =
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    14
  struct
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    15
  fun toString true  = "true"
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    16
    | toString false = "false"
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    17
  end;
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    18
3244
71b760618f30 Basis library version of type "option" now resides in its own structure Option
paulson
parents: 3047
diff changeset
    19
71b760618f30 Basis library version of type "option" now resides in its own structure Option
paulson
parents: 3047
diff changeset
    20
structure Option =
2862
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    21
  struct
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    22
  exception Option
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    23
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    24
  datatype 'a option = NONE | SOME of 'a
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    25
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    26
  fun getOpt (SOME v, _) = v
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    27
    | getOpt (NONE,   a) = a
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    28
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    29
  fun isSome (SOME _) = true 
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    30
    | isSome NONE     = false
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    31
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    32
  fun valOf (SOME v) = v
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    33
    | valOf NONE     = raise Option
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    34
  end;
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    35
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    36
2217
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    37
structure Int =
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    38
  struct
5643
983ce1421211 added Int.int;
wenzelm
parents: 5208
diff changeset
    39
  type int = int
2230
275a5a699ff7 Structure Bool and value Int.toString needed to replace makestring calls
paulson
parents: 2217
diff changeset
    40
  fun toString (i: int) = makestring i;
2217
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    41
  fun max (x, y) = if x < y then y else x : int;
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    42
  fun min (x, y) = if x < y then x else y : int;
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    43
  end;
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
    44
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    45
5208
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    46
structure Real =
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    47
  struct
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    48
  fun toString (x: real) = makestring x;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    49
  fun max (x, y) = if x < y then y else x : real;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    50
  fun min (x, y) = if x < y then x else y : real;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    51
  val real = real;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    52
  val floor = floor;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    53
  fun ceil x = ~1 - floor (~ (x + 1.0));
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    54
  fun round x = floor (x + 0.5);  (*does not do round-to-nearest*)
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    55
  fun trunc x = if x < 0.0 then ceil x else floor x;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    56
  end;
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    57
cea0adbc7276 added Real structure (taken from SML/NJ basis lib);
wenzelm
parents: 5021
diff changeset
    58
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    59
structure List =
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    60
  struct
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    61
  exception Empty
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    62
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    63
  fun last []      = raise Empty
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    64
    | last [x]     = x
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    65
    | last (x::xs) = last xs;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    66
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    67
  fun nth (xs, n) =
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    68
      let fun h []      _ = raise Subscript
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    69
	    | h (x::xs) n = if n=0 then x else h xs (n-1)
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    70
      in if n<0 then raise Subscript else h xs n end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    71
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    72
  fun drop (xs, n) =
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    73
      let fun h xs      0 = xs
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    74
	    | h []      n = raise Subscript
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    75
	    | h (x::xs) n = h xs (n-1)
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    76
      in if n<0 then raise Subscript else h xs n end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    77
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    78
  fun take (xs, n) =
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    79
      let fun h xs      0 = []
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    80
	    | h []      n = raise Subscript
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    81
	    | h (x::xs) n = x :: h xs (n-1)
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    82
      in if n<0 then raise Subscript else h xs n end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    83
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    84
  fun concat []      = []
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
    85
    | concat (l::ls) = l @ concat ls;
2862
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    86
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    87
  fun mapPartial f []      = []
3f38cbd57d47 Now declares Basis Library version of type option
paulson
parents: 2470
diff changeset
    88
    | mapPartial f (x::xs) = 
3244
71b760618f30 Basis library version of type "option" now resides in its own structure Option
paulson
parents: 3047
diff changeset
    89
         (case f x of Option.NONE   => mapPartial f xs
71b760618f30 Basis library version of type "option" now resides in its own structure Option
paulson
parents: 3047
diff changeset
    90
                    | Option.SOME y => y :: mapPartial f xs);
2884
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    91
3244
71b760618f30 Basis library version of type "option" now resides in its own structure Option
paulson
parents: 3047
diff changeset
    92
  fun find _ []        = Option.NONE
71b760618f30 Basis library version of type "option" now resides in its own structure Option
paulson
parents: 3047
diff changeset
    93
    | find p (x :: xs) = if p x then Option.SOME x else find p xs;
2884
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    94
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    95
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    96
  (*copy the list preserving elements that satisfy the predicate*)
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    97
  fun filter p [] = []
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    98
    | filter p (x :: xs) = if p x then x :: filter p xs else filter p xs;
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
    99
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   100
  (*Partition list into elements that satisfy predicate and those that don't.
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   101
    Preserves order of elements in both lists.*)
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   102
  fun partition (p: 'a->bool) (ys: 'a list) : ('a list * 'a list) =
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   103
      let fun part ([], answer) = answer
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   104
	    | part (x::xs, (ys, ns)) = if p(x)
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   105
	      then  part (xs, (x::ys, ns))
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   106
	      else  part (xs, (ys, x::ns))
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   107
      in  part (rev ys, ([], []))  end;
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   108
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   109
  end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   110
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   111
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   112
structure ListPair =
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   113
  struct
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   114
  fun zip ([], [])      = []
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   115
    | zip (x::xs,y::ys) = (x,y) :: zip(xs,ys);
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   116
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   117
  fun unzip [] = ([],[])
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   118
    | unzip((x,y)::pairs) =
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   119
	  let val (xs,ys) = unzip pairs
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   120
	  in  (x::xs, y::ys)  end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   121
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   122
  fun map f ([], [])      = []
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   123
    | map f (x::xs,y::ys) = f(x,y) :: map f (xs,ys);
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   124
2884
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   125
  fun exists p =
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   126
    let fun boolf ([], [])      = false
2884
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   127
	  | boolf (x::xs,y::ys) = p(x,y) orelse boolf (xs,ys)
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   128
    in boolf end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   129
2884
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   130
  fun all p =
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   131
    let fun boolf ([], [])      = true
2884
4f2a4c27f9b5 More List and ListPair utilities
paulson
parents: 2862
diff changeset
   132
	  | boolf (x::xs,y::ys) = p(x,y) andalso boolf (xs,ys)
2265
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   133
    in boolf end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   134
  end;
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   135
3123fef88dce Addition of structures List and ListPair
paulson
parents: 2230
diff changeset
   136
2217
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   137
structure TextIO =
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   138
  struct
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   139
  type instream = instream
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   140
  and  outstream = outstream
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   141
  exception Io of {name: string, function: string, cause: exn}
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   142
  val stdIn 	= std_in
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   143
  val stdOut 	= std_out
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   144
  val openIn 	= open_in
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   145
  val openAppend = open_append
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   146
  val openOut 	= open_out
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   147
  val closeIn 	= close_in
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   148
  val closeOut 	= close_out
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   149
  val inputN 	= input
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   150
  val inputAll  = fn is => inputN (is, 999999)
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   151
  val inputLine = input_line
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   152
  val endOfStream = end_of_stream
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   153
  val output 	= output
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   154
  val flushOut 	= flush_out
411f4683feb6 Basis library emulation for old ML compilers
paulson
parents:
diff changeset
   155
  end;
2470
273580d5c040 A definition of "print", unfortunately overridden by each "open PolyML"
paulson
parents: 2402
diff changeset
   156
273580d5c040 A definition of "print", unfortunately overridden by each "open PolyML"
paulson
parents: 2402
diff changeset
   157
273580d5c040 A definition of "print", unfortunately overridden by each "open PolyML"
paulson
parents: 2402
diff changeset
   158
fun print s = (output (std_out, s); flush_out std_out);
5021
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   159
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   160
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   161
structure General =
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   162
struct
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   163
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   164
local
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   165
  fun raised name = "exception " ^ name ^ " raised";
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   166
  fun raised_msg name msg = raised name ^ ": " ^ msg;
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   167
in
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   168
  fun exnMessage Match = raised_msg "Match" "nonexhaustive match failure"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   169
    | exnMessage Bind = raised_msg "Bind" "nonexhaustive binding failure"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   170
    | exnMessage (Io msg) = "I/O error: " ^ msg
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   171
    | exnMessage Neg = raised "Neg"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   172
    | exnMessage Sum = raised "Sum"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   173
    | exnMessage Diff = raised "Diff"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   174
    | exnMessage Prod = raised "Prod"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   175
    | exnMessage Quot = raised "Quot"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   176
    | exnMessage Abs = raised "Abs"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   177
    | exnMessage Div = raised "Div"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   178
    | exnMessage Mod = raised "Mod"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   179
    | exnMessage Floor = raised "Floor"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   180
    | exnMessage Sqrt = raised "Sqrt"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   181
    | exnMessage Exp = raised "Exp"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   182
    | exnMessage Ln = raised "Ln"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   183
    | exnMessage Ord = raised "Ord"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   184
    | exnMessage Subscript = raised_msg "Subscript " "subscript out of bounds"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   185
    | exnMessage Option.Option = raised "Option.Option"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   186
    | exnMessage List.Empty = raised "List.Empty"
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   187
    | exnMessage (TextIO.Io {name, ...}) = raised_msg "TextIO.Io" name
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   188
    | exnMessage exn = raised "???";
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   189
end;
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   190
235f8508d440 added exnMessage;
wenzelm
parents: 3244
diff changeset
   191
end;