diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/Col2.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_compile/Col2.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/Col2.hs b/testsuite/tests/indexed-types/should_compile/Col2.hs new file mode 100644 index 0000000000..97a10aef84 --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/Col2.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE FlexibleContexts #-} + +module Col where + +type family Elem c + +type instance Elem [e] = e + +class (Eq (Elem c)) => Col c where + count :: Elem c -> c -> Int + +instance Eq e => Col [e] where + count x = length . filter (==x) |