diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/ColInference.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_compile/ColInference.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/ColInference.hs b/testsuite/tests/indexed-types/should_compile/ColInference.hs new file mode 100644 index 0000000000..a70b7dd444 --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/ColInference.hs @@ -0,0 +1,19 @@ +{-# 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) + +addAll c1 c2 + | isEmpty c1 + = c2 + | otherwise + = let (x,c1') = headTail c1 + in addAll c1' (add c2 x) |