summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/Deriving.hs
blob: fd0eff20161c10f751902012e9bca6a183694f6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# LANGUAGE TypeFamilies, StandaloneDeriving, FlexibleInstances #-}

module ShouldCompile where

data family T a

data instance T Int = A | B
		    deriving Eq

foo :: T Int -> Bool
foo x = x == x

data instance T Char = C

instance Eq (T Char) where
  C == C = False

data family R a
data instance R [a] = R

deriving instance Eq (R [a])

class C a where
  data S a

instance C Int where
  data S Int = SInt deriving Eq

bar :: S Int -> Bool
bar x = x == x