]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/TypeClass2.scl
Automatic execution of SCL tests in Maven
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / TypeClass2.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/TypeClass2.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/TypeClass2.scl
new file mode 100644 (file)
index 0000000..5bd0935
--- /dev/null
@@ -0,0 +1,28 @@
+import "JavaBuiltin" as Java\r
+\r
+(+) = Java.iadd\r
+\r
+class Foo a where\r
+    foo :: a -> Integer\r
+    /*\r
+class (Foo a) => Bar a where\r
+    bar :: a -> Integer\r
+    */\r
+instance Foo Integer where\r
+    foo x = x+1\r
+  /*  \r
+instance Bar Integer where\r
+    bar x = x+2\r
+*/\r
+data X a = X a\r
+\r
+instance (Foo a) => Foo (X a) where\r
+    foo (X a) = foo a\r
+    /*\r
+instance (Bar a) => Bar (X a) where\r
+    bar (X a) = bar a*/\r
+    \r
+main = foo (X (1 :: Integer))\r
+// + bar (X (2 :: Integer))\r
+--\r
+2
\ No newline at end of file