]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/TypeClassBug2.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 / TypeClassBug2.scl
index a341ba6b2a0962a2888b321481bba39c39511b4f..b20ade0acab838d6794b64d82cf4a77e82aad676 100644 (file)
@@ -1,54 +1,54 @@
-data Foo1 a = Foo1 a\r
-data Foo2 a = Foo2 a\r
-\r
-foo1 :: Foo1 a -> a\r
-foo1 (Foo1 x) = x\r
-\r
-foo2 :: Foo2 a -> a\r
-foo2 (Foo2 x) = x\r
-\r
-class Makeable s where\r
-    make :: a -> s a\r
-\r
-instance Makeable Foo1 where\r
-    make = Foo1\r
-\r
-instance Makeable Foo2 where\r
-    make = Foo2\r
-\r
-class (Makeable f) => Foo f where\r
-    foo :: f a -> a\r
-\r
-class (Makeable b) => Bar b where\r
-    bar :: b a -> a\r
-\r
-class (Makeable b) => Baz b where\r
-    baz :: b a -> a\r
-\r
-class (Makeable b) => Bim b where\r
-    bim :: b a -> a\r
-\r
-instance Foo Foo1 where\r
-    foo = foo1\r
-    \r
-instance Bar Foo2 where\r
-    bar = foo2\r
-    \r
-instance (Bar b) => Baz b where\r
-    baz = bar\r
-\r
-instance Bim Foo1 where\r
-    bim = foo1\r
-\r
-instance (Baz b) => Bim b where\r
-    bim = baz\r
-\r
-doFoo1 (Foo1 x) = x\r
-doFoo2 (Foo2 x) = x\r
-\r
-useBim :: Bim b => (forall a. b a -> a) -> a -> [a]\r
-useBim doit x = [doit (make x), bim (make x :: Foo1 a)]\r
-\r
-main = "OK"\r
---\r
-"OK"\r
+data Foo1 a = Foo1 a
+data Foo2 a = Foo2 a
+
+foo1 :: Foo1 a -> a
+foo1 (Foo1 x) = x
+
+foo2 :: Foo2 a -> a
+foo2 (Foo2 x) = x
+
+class Makeable s where
+    make :: a -> s a
+
+instance Makeable Foo1 where
+    make = Foo1
+
+instance Makeable Foo2 where
+    make = Foo2
+
+class (Makeable f) => Foo f where
+    foo :: f a -> a
+
+class (Makeable b) => Bar b where
+    bar :: b a -> a
+
+class (Makeable b) => Baz b where
+    baz :: b a -> a
+
+class (Makeable b) => Bim b where
+    bim :: b a -> a
+
+instance Foo Foo1 where
+    foo = foo1
+    
+instance Bar Foo2 where
+    bar = foo2
+    
+instance (Bar b) => Baz b where
+    baz = bar
+
+instance Bim Foo1 where
+    bim = foo1
+
+instance (Baz b) => Bim b where
+    bim = baz
+
+doFoo1 (Foo1 x) = x
+doFoo2 (Foo2 x) = x
+
+useBim :: Bim b => (forall a. b a -> a) -> a -> [a]
+useBim doit x = [doit (make x), bim (make x :: Foo1 a)]
+
+main = "OK"
+--
+"OK"