[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.3.2 Named types

Nametype definitions associate a name with a type expression, meaning that `.' and `( , , )' operate on it as type constructors rather than value expressions. The type name may not take parameters.

For example,

 
nametype Values = {0..199}
nametype Ranges = Values . Values

has the same effect as

 
Values = {0..199}
Ranges = { x.y | x<-Values, y<-Values }

Note that outside of the `top-level' of a nametype (or datatype, or subtype) definition, the expression `Values . Values' has the entirely different meaning of two copies of the set Values joined by the infix dot. Similarly the expression `(Values,Values)' means the cartesian product of Values for the construction of a type, but a pair of two sets in all other contexts.



Formal Systems (Europe) Ltd FDR2 Manual