summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/InstanceGivenOverlap.hs
blob: 765379a2032a8c85ae63715a44e73759ae59c690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE ScopedTypeVariables, FlexibleInstances, MultiParamTypeClasses,
             TypeFamilies, FlexibleContexts, AllowAmbiguousTypes #-}

module InstanceGivenOverlap where

-- See Note [Instance and Given overlap] in GHC.Tc.Solver.Interact.
-- This tests the Note when the Wanted contains a type family.

class P a
class Q a
class R a b

instance P x => Q [x]
instance (x ~ y) => R y [x]

type family F a b where
  F [a] a = a

wob :: forall a b. (Q [F a b], R b a) => a -> Int
wob = undefined

g :: forall a. Q [a] => [a] -> Int
g x = wob x