-
Notifications
You must be signed in to change notification settings - Fork 1
Type Syntax
sw17ch edited this page Mar 23, 2012
·
6 revisions
Types are defined as one of the following:
- TypeName
- TypeVariable
- ParameterizedType
- FunctionType
Pattern: [A-Z][A-Za-z0-9_]*
Examples:
UInt32FooFlabbaJabbaJangalang
Pattern: [a-z_][A-Za-z0-9_]*
Examples:
fooa_zoopdarthVadar86(parensOptional)
Parameterized types are a Type Name or a Type Variable followed by any number of Type Names, Type Variables, or Function Types.
Pattern: [TypeName | TypeVariable][TypeName | TypeVariable | FunctionType]+
Examples:
Foo aFoo Int aFlippity Floppity (a -> flooby)a Int (Foo a)(Parens optional)
Function types are any number of parameters, an arrow (->), and a return type.
Pattern: ([AnyType](,[AnyType]*)){0,1}->[AnyType]{0,1}
Examples:
->a -> bInt, a -> Bar(a -> b) -> b-> IntInt ->Foo a, Bar b, Baz (Foo a) -> Int