| 1 |
(* This should fail because 'a -> 'b is not a type name; |
| 2 |
* The Defn does not treat -> as a TyName(2), but rather as a distinct |
| 3 |
* sub-class of Type. *) |
| 4 |
signature S = |
| 5 |
sig |
| 6 |
datatype ('a, 'b) t = T of 'a -> 'b |
| 7 |
end where type ('a, 'b) t = 'a -> 'b |
| 8 |
|
| 9 |
(* Similarly, this should fail because 'a * 'b is not a type name; |
| 10 |
* it is a synonym for {1: 'a, 2: 'b}, which is RowType. *) |
| 11 |
signature S = |
| 12 |
sig |
| 13 |
datatype ('a, 'b) t = T of 'a * 'b |
| 14 |
end where type ('a, 'b) t = 'a * 'b |
| 15 |
|
| 16 |
(* Similarly, this should fail because 'a * 'b is not a type name; |
| 17 |
* it is a synonym for {1: 'a, 2: 'b}, which is RowType. *) |
| 18 |
signature S = |
| 19 |
sig |
| 20 |
datatype t = T of unit |
| 21 |
end where type t = unit |
| 22 |
|
| 23 |
(* On the other hand, The Defn does treat 'ref' and 'int' and other |
| 24 |
* primitive types as TyName(k); see Appendix C. Hence, the following |
| 25 |
* should succeed. *) |
| 26 |
signature S = |
| 27 |
sig |
| 28 |
datatype 'a t = T of 'a ref |
| 29 |
end where type 'a t = 'a ref |
| 30 |
signature S = |
| 31 |
sig |
| 32 |
datatype t = T of int |
| 33 |
end where type t = int |