blob: b3b639f126c9a4c774651950ea0871b6beb80810 (
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
|