]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/SpecConstr1.scl
(refs #7307) Added features field to SCL module header
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / SpecConstr1.scl
1 data Either a b = Left a | Right b
2
3 data List a = Nil | Cons a (List a)
4
5 data Nat = Zero | Succ Nat
6
7 sum Zero a = a
8 sum a Zero = a
9 sum (Succ a) (Succ b) = Succ (Succ (sum a b))
10
11 sum_append xs ys
12  = go Zero (Left xs)
13  where
14     go z (Left xs)
15       = match xs with
16         Nil -> go z (Right ys)
17         Cons x xs' -> go (sum x z) (Left xs')
18     go z (Right ys)
19       = match ys with
20         Nil -> z
21         Cons y ys' -> go (sum y z) (Right ys')
22
23 main = "Hello world!"
24 --
25 Hello world!