X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FTypeClass2.scl;h=6afa3a503acfc45e758c8ea6709be9d5c4c9ed96;hp=5bd09350bdbe15617361fd6ce12b92c908d9bb9f;hb=172abed5dbf73c1304a7a95bb8504ea293556948;hpb=dcca7344e1da6f975859fd79fbc6cead7d363042 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 index 5bd09350b..6afa3a503 100644 --- 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 @@ -1,28 +1,28 @@ -import "JavaBuiltin" as Java - -(+) = Java.iadd - -class Foo a where - foo :: a -> Integer - /* -class (Foo a) => Bar a where - bar :: a -> Integer - */ -instance Foo Integer where - foo x = x+1 - /* -instance Bar Integer where - bar x = x+2 -*/ -data X a = X a - -instance (Foo a) => Foo (X a) where - foo (X a) = foo a - /* -instance (Bar a) => Bar (X a) where - bar (X a) = bar a*/ - -main = foo (X (1 :: Integer)) -// + bar (X (2 :: Integer)) --- +import "JavaBuiltin" as Java + +(+) = Java.iadd + +class Foo a where + foo :: a -> Integer + /* +class (Foo a) => Bar a where + bar :: a -> Integer + */ +instance Foo Integer where + foo x = x+1 + /* +instance Bar Integer where + bar x = x+2 +*/ +data X a = X a + +instance (Foo a) => Foo (X a) where + foo (X a) = foo a + /* +instance (Bar a) => Bar (X a) where + bar (X a) = bar a*/ + +main = foo (X (1 :: Integer)) +// + bar (X (2 :: Integer)) +-- 2 \ No newline at end of file