summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/indexed-types/should_compile/ColInference.hs
blob: a70b7dd44401f19686d595c47646aa687d632ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)