]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/SpecConstr1.scl
Automatic execution of SCL tests in Maven
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / SpecConstr1.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/SpecConstr1.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/SpecConstr1.scl
new file mode 100644 (file)
index 0000000..4ff7d47
--- /dev/null
@@ -0,0 +1,25 @@
+data Either a b = Left a | Right b\r
+\r
+data List a = Nil | Cons a (List a)\r
+\r
+data Nat = Zero | Succ Nat\r
+\r
+sum Zero a = a\r
+sum a Zero = a\r
+sum (Succ a) (Succ b) = Succ (Succ (sum a b))\r
+\r
+sum_append xs ys\r
+ = go Zero (Left xs)\r
+ where\r
+    go z (Left xs)\r
+      = match xs with\r
+        Nil -> go z (Right ys)\r
+        Cons x xs' -> go (sum x z) (Left xs')\r
+    go z (Right ys)\r
+      = match ys with\r
+        Nil -> z\r
+        Cons y ys' -> go (sum y z) (Right ys')\r
+\r
+main = "Hello world!"\r
+--\r
+Hello world!
\ No newline at end of file