summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/ColInference4.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/ColInference4.hs')
-rw-r--r--testsuite/tests/indexed-types/should_compile/ColInference4.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/ColInference4.hs b/testsuite/tests/indexed-types/should_compile/ColInference4.hs
new file mode 100644
index 0000000000..27675b1051
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_compile/ColInference4.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module ColInference where
+
+type family Elem c
+
+type instance Elem [e] = e
+
+class Col c where
+ isEmpty :: c -> Bool
+ add :: c -> Elem c -> c
+ headTail :: c -> (Elem c,c)
+
+sawpOne c1 c2
+ = let (x,c1') = headTail c1
+ (y,c2') = headTail c2
+ in (add c1' y,add c1' x)