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