swarm/example
Brent Yorgey 01c45ab968
Type synonyms (#1865)
Adds type synonym declarations to the language, like so:
```
tydef Maybe a = Unit + a end
def lookdown : Cmd (Maybe Text) = scan down end

> lookdown
it2 : Maybe Text = inl ()
```

`tydef` behaves very similarly to `def` except that it defines a new (parameterized) type instead of a new term.

Note that higher-kinded types are not yet supported; for example we cannot say `tydef Foo f = Unit + f Int` (in fact this would be a syntax error since type variables cannot be at the head of an application).  However there is nothing stopping us from adding that in the future; I just wanted to keep things simple for now.

If you know of any scenario code that would be a good candidate for using type synonyms, let me know --- it would be nice to update a few scenarios as a better stress test of type synonyms before merging this.

Closes #153.
2024-06-01 21:09:50 +00:00
..
BFS-clear.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
cat.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
dfs.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
fact.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
list.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
maybe.sw Type synonyms (#1865) 2024-06-01 21:09:50 +00:00
multi-key-handler.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
pilotmode.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00
wander.sw Require types to start with an uppercase letter (#1583) 2024-05-21 04:16:32 +00:00