summaryrefslogtreecommitdiff
path: root/src/test/test3.sail
diff options
context:
space:
mode:
authorGabriel Kerneis2013-11-12 16:01:52 +0000
committerGabriel Kerneis2013-11-12 16:09:41 +0000
commitf2717777c8c1159511c6af70c22338d243ea6d68 (patch)
tree34d959c5c2313060a811a702d945261c6072d657 /src/test/test3.sail
parent4e005a7065f88fb2ba4888c51dc8c0508d867e3f (diff)
Define and test addition in library
Notice the need for double parentheses in test/test3.sail, because the interpreter does not perform curryfication automatically (only the first parameter in kept with List_extra.head): add ((1, 3)) (* works *) add (1, 3) (* fails, equivalent to: add (1) *) Fortunately enough, infix functions work correctly by default. A dirty quickfix would be easy, but I'm not sure at which level this should be addressed properly (interpreter? typing? etc.).
Diffstat (limited to 'src/test/test3.sail')
-rw-r--r--src/test/test3.sail6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test3.sail b/src/test/test3.sail
index 3127db28..8d0d9056 100644
--- a/src/test/test3.sail
+++ b/src/test/test3.sail
@@ -7,8 +7,8 @@ val ( nat -> nat effect { wmem , rmem } ) MEM_GPU
val ( ( nat * nat ) -> nat effect { wmem , rmem } ) MEM_SIZE
(* extern functions *)
-val extern ( nat -> nat pure ) add = "add"
-val extern ( nat -> nat pure ) (: + ) = "add_infix" (* infix plus *)
+val extern ( ( nat * nat ) -> nat pure ) add = "add"
+val extern ( ( nat * nat ) -> nat pure ) (: + ) = "add_infix" (* infix plus *)
function nat (: * ) ( < nat > x, < nat > y ) = 42
@@ -36,5 +36,5 @@ function nat main _ = {
(* extern calls *)
3 + 39;
- add(5);
+ add((5, 37));
}