-
Notifications
You must be signed in to change notification settings - Fork 0
Types DSL
There are two basic ways to create complex types by composing simpler ones.
First, some types have type parameters that indicate an of
type relationship,
eg. list(int(+))
meaning a list of integers
.
Second, some types can be nested, resulting in their operations being composed, which corresponds to a
within
type relationship, eg. list / list(int(+))
meaning a list-within-a-list of integers
.
The distinction between these two types of composition makes it possible to precisely specify
how deep an operation should be: a map
over list(list(int(+)))
will map over lists within the outer list,
while a map
over list / list(int(+))
will map over the integers within the inner lists.
id(InnerType)
Identity functor, which behaves exactly as the inner type for operations that are available for it,
but which also adds some other operations, most notably map
.
list(ContentType)
(Type1, ..., TypeN)
functor(Symbol, Arity, Fields)
Type of functors (complex terms) of given Symbol and Arity (which can be variables).
Fields
can be of any of the following forms:
-
FieldNumber
- indicates a single field that the functor can be mapped on, starting at 1 -
FieldNumber / FieldType
- indicates a single field that should be treated as a nested (categorical) functor of typeFieldtype
-
[FieldNumber]
and[FieldNumber / FieldType]
- (typed) multi-field variant that allows mapping multiple fields (possibly as nested functors)