d466e487e9babff5608fd9ef673b4b8eb13726f3
[ghc.git] / testsuite / tests / typecheck / should_compile / T1470.hs
1 {-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, OverlappingInstances, UndecidableInstances, KindSignatures #-}
2
3 -- Trac #1470
4
5 module Foo where
6
7 class Sat a
8 class Data (ctx :: * -> *) a
9 instance Sat (ctx Char) => Data ctx Char
10 instance (Sat (ctx [a]), Data ctx a) => Data ctx [a]
11
12 class Data FooD a => Foo a
13
14 data FooD a = FooD
15
16 instance Foo t => Sat (FooD t)
17
18 instance Data FooD a => Foo a
19
20
21 instance Foo a => Foo [a]
22 {-
23 Given: Foo a,
24 and its superclasses: Data FooD a
25
26 Want superclass: Data FooD [a]
27
28 by instance Data FooD [a]
29 want: Sat (FooD [a])
30 Data FooD a -- We have this
31
32 by instance Sat (FooD t)
33 want: Foo [a]
34
35 BUT THIS INSTANCE OVERLAPS
36 -}
37
38 instance Foo [Char]