]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/BinaryOperators1.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 / BinaryOperators1.scl
1 import "Prelude"
2
3 data E = E String
4
5 instance Additive E where
6     zero = E "0"
7     E a + E b = E ("(" + a + "+" + b + ")")
8     
9 instance Ring E where
10     one = E "1"
11     neg (E a) = E ("(-" + a + ")")
12     E a - E b = E ("(" + a + "-" + b + ")")
13     E a * E b = E ("(" + a + "*" + b + ")") 
14     fromInteger x = E (show x)
15
16 eToString (E a) = a
17
18 a = E "a"
19 b = E "b"
20 c = E "c"
21 d = E "d"
22
23 main = eToString (-a + b + (-c*d))
24 --
25 (((-a)+b)+(-(c*d)))