Bump `base` version to 4.9.0.0 (closes #11026)
[ghc.git] / testsuite / tests / typecheck / should_fail / tcfail218.hs
1 {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
2
3 module Tcfail218 where
4
5 class C a b where foo :: (a,b)
6
7 instance C [Int] Bool where foo = undefined
8 instance C [a] b where foo = undefined
9 instance {-# INCOHERENT #-} C a Int where foo = undefined
10
11
12 x :: ([a],Bool)
13 -- Needs C [a] b.
14 -- Should fail, as a more specific, unifying but not matching
15 -- non-incoherent instance exists, namely C [Int] Bool
16 x = foo
17
18 -- Needs C [a] Int.
19 -- Should succeed, because two instances match, but one is incoherent
20 y :: ([a],Int)
21 y = foo
22