General
structure
signature GENERAL
structure General
:> GENERAL
The structure General
defines exceptions, datatypes, and functions which are used throughout the SML Basis Library, and are useful in a wide range of programs.
All of the types and values defined in General
are available unqualified at the top-level.
eqtype unit
type exn = exn
exception Bind
exception Match
exception Chr
exception Div
exception Domain
exception Fail of string
exception Overflow
exception Size
exception Span
exception Subscript
val exnName : exn -> string
val exnMessage : exn -> string
datatype order = LESS | EQUAL | GREATER
val ! : 'a ref -> 'a
val := : 'a ref * 'a -> unit
val o : ('b -> 'c) * ('a -> 'b) -> 'a -> 'c
val before : 'a * unit -> 'a
val ignore : 'a -> unit
eqtype unit
()
, which is typically used as a trivial argument or as a return value for a side-effecting function.
type exn = exn
exception Bind
exception Match
val
binding or, respectively, in a case
expression or function application. This occurs when the matched value is not an instance of any of the supplied patterns.
exception Chr
CHAR.chr
).
exception Div
Mod
exception required by the SML'90 Definition.
exception Domain
MATH
or INT_INF
signatures. It replaces the Sqrt
and Ln
exceptions required by the SML'90 Definition.
exception Fail of string
exception Overflow
Abs
, Exp
, Neg
, Prod
, Quot
, and Sum
exceptions required by the SML'90 Definition.
exception Size
exception Span
SUBSTRING.span
to two incompatible substrings.
exception Subscript
exnName ex
let exception E1; exception E2 = E1 in exnName E2 endmight evaluate to
"E1"
or "E2"
.
exnMessage ex
exnName
ex
.
Example:
exnMessage Div = "Div" exnMessage (OS.SysErr ("No such file", NONE)) = "OS.SysErr \"No such file\""
datatype order = LESS | EQUAL | GREATER
order
are used when comparing elements of a type that has a linear ordering.
! re
re := a
f o g
(f o g) a
is equivalent to f(g a)
.
a before b
ignore a
()
. The purpose of ignore
is to discard the result of a computation, returning ()
instead. This is useful, for example, when a higher-order function, such as List.app
, requires a function returning unit
, but the function to be used returns values of some other type.
Some systems may provide a compatibility mode in which the exceptions replaced from SML'90 (e.g., Abs
, Sqrt
) are provided at top-level as aliases for the new exceptions.
Generated October 02, 2003
Last Modified February 20, 1997
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2003 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
University Press.
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America). |