blob: b3cb620bf967bee8dcff2f2ee27e01482e97a3b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
_T_y_p_e_ _s_y_n_o_n_y_m_ _d_e_c_l_a_r_a_t_i_o_n_s
These permit the user to introduce a new name for an already existing
type, e.g.
string == [char]
type synonyms are entirely transparent to the typechecker (it best to
think of them as being just macros). For obvious reasons, recursive type
synonyms are not permitted.
It is also possible to introduce a synonym for a type forming operator,
by introducing generic type variable as parameters of the definition,
e.g.
invt * ** == (*->**)->(**->*)
So within a script containing the above two `==' definitions, the type
`invt num string' will be shorthand for
(num->[char])->([char]->num)
|