From 4ba55277a99542d245568da989b5217b04262f26 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 1 Feb 2023 21:22:23 +0100 Subject: Remove ambiguity from function definition syntax: Type (x y) could have Type as kind *->*, or (x y) could be the rhs --- doc/docs/frontend/syntax.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc') 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)`. -- cgit v1.2.3