summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/T9090.hs
blob: 7dc065d6390854604edddaba2d632dbdce1faee5 (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
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE RankNTypes, ConstraintKinds, TypeFamilies #-}

module T9090 where

import GHC.Exts (Constraint)

type family F (c :: Constraint) :: Constraint
type instance F (Eq a) = Eq a

-- checks
f :: Eq b => (forall a. F (Eq a) => f a -> Bool) -> f b -> Bool
f _ = error "urk" -- g x = g x

-- checks
f' :: Eq b => (forall a. Eq a => f a -> Bool) -> f b -> Bool
f' = f

-- checks, so GHC seems to think that both types are interchangeable
f'' :: Eq b => (forall a. F (Eq a) => f a -> Bool) -> f b -> Bool
f'' = f'

-- checks
test' y = f' (\ (Just x) -> x /= x) y

-- fails
test y = f (\ (Just x) -> x /= x) y

-- fails too, unsurprisingly
test'' y = f'' (\ (Just x) -> x /= x) y