diff options
author | Camil Staps | 2023-02-01 21:22:23 +0100 |
---|---|---|
committer | Camil Staps | 2023-02-01 21:22:23 +0100 |
commit | 4ba55277a99542d245568da989b5217b04262f26 (patch) | |
tree | ba6b4ed2d1da9a1c46256fd58f126ef387512ed5 /doc/docs | |
parent | Use <<|> instead of <|> in parser to reduce memory usage (diff) |
Remove ambiguity from function definition syntax: Type (x y) could have Type as kind *->*, or (x y) could be the rhs
Diffstat (limited to 'doc/docs')
-rw-r--r-- | doc/docs/frontend/syntax.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/docs/frontend/syntax.md b/doc/docs/frontend/syntax.md index 836201c..17436af 100644 --- a/doc/docs/frontend/syntax.md +++ b/doc/docs/frontend/syntax.md @@ -40,19 +40,19 @@ Type synonyms can be defined with: ## Functions ```snug -(fun length ((xs : List a)) : Int - (length_acc 0 xs)) +(fun length ((xs : List a)) : Int : + length_acc 0 xs) -(fun length_acc ((n : Int) (xs : List a)) : Int - (case xs ( +(fun length_acc ((n : Int) (xs : List a)) : Int : + case xs ( (Nil -> n) - (Cons _ xs -> length_acc (+ n 1) xs)))) + (Cons _ xs -> length_acc (+ n 1) xs))) ``` In abstract terms, the syntax is: ```snug -(fun NAME (ARGUMENTS) : TYPE (EXPRESSION)) +(fun NAME (ARGUMENTS) : TYPE : EXPRESSION) ``` where arguments are of the form `(NAME : TYPE)`. |