summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.hs
blob: 054e5132360a2a0d2004a6fc476317a243bdf200 (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
{-# LANGUAGE FlexibleContexts #-}

module FailDueToGivenOverlapping where

class C a where

class D a where
 dop :: a -> ()


instance C a => D [a]

-- should succeed since we can't learn anything more for 'a'
foo :: (C a, D [Int]) => a -> ()
foo x = dop [x]


class E a where
 eop :: a -> ()

instance E [a] where
 eop = undefined

-- should fail since we can never be sure that we learnt
-- everything about the free unification variable.
bar :: E [Int] => () -> ()
bar _ = eop [undefined]