@@ -147,31 +147,34 @@ This is the same type system as in Apalache:
147
147
148
148
A type is one of the following:
149
149
150
- - Basic type: ` bool ` , ` int ` , ` str ` .
150
+ - Basic type: ` bool ` , ` int ` , ` str ` .
151
151
152
- - Uninterpreted type or type name: ` IDENTIFIER_IN_CAPS ` .
152
+ - Uninterpreted type or type name: ` IDENTIFIER_IN_CAPS ` .
153
153
154
- - Type variable (parameter): ` a ` , ..., ` z ` .
154
+ - Type variable (parameter): ` a ` , ..., ` z ` .
155
155
156
- - Set: ` Set[T] ` for a type ` T ` .
156
+ - Set: ` Set[T] ` for a type ` T ` .
157
157
158
- - List: ` List[T] ` for a type ` T ` .
158
+ - List: ` List[T] ` for a type ` T ` .
159
159
160
- - Tuple: ` (T_1, T_2, ..., T_n) ` for ` n >= 2 ` types ` T_1 ` , ..., ` T_n ` .
160
+ - Tuple: ` (T_1, T_2, ..., T_n) ` for ` n >= 2 ` types ` T_1 ` , ..., ` T_n ` .
161
161
162
- - Record: ` { name_1: T_1, name_2: T_2, ..., name_n: T_n } `
163
- for ` n >= 1 ` types ` T_1 ` , ..., ` T_n ` .
162
+ - Record: ` { name_1: T_1, name_2: T_2, ..., name_n: T_n } `
163
+ for ` n >= 1 ` types ` T_1 ` , ..., ` T_n ` .
164
164
165
- - Function: ` T1 -> T2 ` for types ` T1 ` and ` T2 ` .
165
+ - Function: ` T1 -> T2 ` for types ` T1 ` and ` T2 ` .
166
166
167
- - Operator: ` (T_1, ..., T_n) => R ` for ` n >= 0 ` argument types ` T_1, ..., T_n `
168
- and result type ` R ` .
167
+ - Operator: ` (T_1, ..., T_n) => R ` for ` n >= 0 ` argument types ` T_1, ..., T_n `
168
+ and result type ` R ` .
169
169
170
- - Sum Types: ` type T = L_1(T_1) | ... | L_n(T_n) ` for ` n >= 1 ` , argument types
171
- ` T_1 ` , ..., ` T_n ` , and a type alais ` T ` .
170
+ - Sum Types: ` type T = L_1(T_1) | ... | L_n(T_n) ` for ` n >= 1 ` , argument types
171
+ ` T_1 ` , ..., ` T_n ` , and a type alais ` T ` .
172
172
173
- - Type in parentheses: ` (T) ` for a type ` T ` .
173
+ - Type in parentheses: ` (T) ` for a type ` T ` .
174
174
175
+ - An instance of a defined polymorphic type ` T[T_1, ..., T_n] ` for a defined type
176
+ constructor with type parameters ` T[p_1, ..., p_n] ` and types `T_1, ...,
177
+ T_n`.
175
178
176
179
It is often convenient to declare a type alias. You can use ` type ` to define
177
180
an alias inside a module definition. For instance:
@@ -180,6 +183,18 @@ an alias inside a module definition. For instance:
180
183
type Temperature = int
181
184
```
182
185
186
+ A type alias specified with type parameters defines a polymorphic type
187
+ constructor for instances of the defined type. For instance, given
188
+
189
+ ``` bluespec
190
+ type Option[a] =
191
+ | Some(a)
192
+ | None
193
+ ```
194
+
195
+ You can then construct concrete types such as ` Option[int] ` or
196
+ ` Option[List[int]] ` .
197
+
183
198
A type identifier can also introduce an uninterpreted type by defining a type without any constructors for values of that type:
184
199
185
200
``` bluespec
0 commit comments