]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/RecursiveContext.scl
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / RecursiveContext.scl
1 import "JavaBuiltin" as Java
2
3 infixl 6  (+), (-)
4
5 class Num a where 
6     (+) :: a -> a -> a
7     (-) :: a -> a -> a
8     isZero :: a -> Boolean
9     one :: a     
10     
11 instance Num Integer where
12     x + y = Java.iadd x y
13     x - y = Java.isub x y
14     isZero x = Java.icmpeq Java.iconst_0 x
15     one = Java.iconst_1
16   
17 even x = if isZero x then True else odd (x - one)
18 odd x = if isZero x then False else even (x - one)   
19     
20 main = odd (8 :: Integer)
21 --
22 false
23