summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/T3017.hs
blob: 8e4e5bd99910c102053842e8869e9e9e7c5fe1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE TypeFamilies #-}

-- Trac #3017

module Foo where
 class Coll c where
   type Elem c
   empty :: c
   insert :: Elem c -> c -> c

 data ListColl a = L [a]
 instance Coll (ListColl a) where
   type Elem (ListColl a) = a
   empty = L []
   insert x (L xs) = L (x:xs)

 emptyL :: ListColl a
 emptyL = empty

 test2 c = insert (0, 0) c