aboutsummaryrefslogtreecommitdiff
path: root/TUTORIAL.md
diff options
context:
space:
mode:
Diffstat (limited to 'TUTORIAL.md')
-rw-r--r--TUTORIAL.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/TUTORIAL.md b/TUTORIAL.md
index 9c85478..4ae36db 100644
--- a/TUTORIAL.md
+++ b/TUTORIAL.md
@@ -130,6 +130,43 @@ and after it it is too, while in the middle term where
`x = 2` is defined, `x = 2`.
+Types
+-----
+
+Types are written as seen in the return types in the REPL.
+The base types of myslip are
+* `Int` for integer
+* `Bool` for boolean
+* `Nil` for `()`
+* `Type` for type literals
+* `Let` (what'd be the sensible type if not a special one?)
+* `Quote`, `Vector` and `Sum` for use in data structures.
+The types used in data structures will be covered later.
+
+These can be combined using the arrow type, list type and
+vector type.
+
+`(A -> B)` denotes a function with arguments of type `A`
+and a return value of type `B`.
+
+`(A B C D)` denotes a 4-length list with the respective types
+at respective positions. Though if it is an actual list not
+to be interpreted, in most cases a `Quote` will be present in
+the type: `(Quote (A B C D))`. Note that the length of a list
+can be any nonnegative integer (within memory constraints),
+but it needs to be fixed.
+
+`(A ...)` denotes a list the length of which is not known and
+whose each element is of type `A`. If this is in a vector
+structure, `Vector` is prepended as such: `(Vector (A ...))`.
+
+`(Sum A B)` denotes the type of a coproduct, the left type of
+which is `A` and right type `B`.
+
+Generics have limited support in myslip.
+They are written in uppercase.
+
+
Functions
---------