4.4. Syntax of Typed Orc

The following figure summarizes the syntax of typed Orc as an extension of untyped Orc. The original Orc grammar rules are abbreviated by ellipses (...).

Table 4.1. Typed Orc

T::= Type  
  X  Type variable
 | Integer | Boolean | String | Number | Signal | Top | Bot   Ground type
 | ( T , ... , T )   Tuple type
 | lambda [ X , ... , X ] ( T , ... , T ) :: T  Function type
 |X[ T , ... , T ]   Type application
D::= ... Declaration  
 | type X = classname   type import
 | type X[ X , ... , X ] = T  type alias
 | type X[ X , ... , X ] = TC | ... | TC   datatype declaration (typed)
 | def X[ X , ... , X ] ( T , ... , T ) :: T  function signature
TC::= X( T , ... , T ) Constructor (typed)  
E::=... Expression  
 |E :: T  type ascription
 |E :!: T  type assertion
 | lambda [ T , ... , T ] ( P , ... , P ) :: T = E   closure (typed)
G::=... Argument group  
   [ T , ... , T ] ( E , ... , E )   type parameters plus arguments
P::=... Pattern  
 |P :: T  type ascription