summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/indexed-types/should_compile/Col2.hs
blob: 97a10aef842f4e49d48686824532b11d14571898 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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)