]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/TypeClass2.scl
Merge commit 'd186091'
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / TypeClass2.scl
1 import "JavaBuiltin" as Java\r
2 \r
3 (+) = Java.iadd\r
4 \r
5 class Foo a where\r
6     foo :: a -> Integer\r
7     /*\r
8 class (Foo a) => Bar a where\r
9     bar :: a -> Integer\r
10     */\r
11 instance Foo Integer where\r
12     foo x = x+1\r
13   /*  \r
14 instance Bar Integer where\r
15     bar x = x+2\r
16 */\r
17 data X a = X a\r
18 \r
19 instance (Foo a) => Foo (X a) where\r
20     foo (X a) = foo a\r
21     /*\r
22 instance (Bar a) => Bar (X a) where\r
23     bar (X a) = bar a*/\r
24     \r
25 main = foo (X (1 :: Integer))\r
26 // + bar (X (2 :: Integer))\r
27 --\r
28 2