1 (* This example is interesting because at the time
of generalization
of f
, the
2 * tyvar
'a is
in scope
, but does not appear
in type types
of any
of the
3 * variables
in the
environment (x
's
type has not yet been determined to be
'a
).
4 * Nevertheless
, it is essential to not generalize
'a at g
10 | g _
= raise Fail
"bug"
15 (* This example is interesting because it binds a
type variable at a scope
where
16 * the
type variable does not appear
in the
type. Nevertheless
, it is essential
17 * to keep the
type variable there
, because it occurs
in an inner scope
.
21 val x
: 'a
= raise Fail
"bug"
26 (* This example shows that
type variables can be rebound
in nested
datatype
27 * declarations
, unlike the situation for nested value declarations
.
32 datatype 'a t
= T
of 'a
37 (* This example verifies that
datatype replication is allowed
, even when the
38 * right
-hand side isn
't a
datatype.
41 datatype u
= datatype t
42 val _
: int u
= (13, 14);
44 (* The following examples demonstrate acceptable forms
of type variable scoping
.
77 datatype 'a t
= T
of 'a
82 (* This example confirms that bools can be used
as labels
. *)
83 val {false = x
, ...} = {false = 13};