Update Trac ticket URLs to point to GitLab
[ghc.git] / testsuite / tests / indexed-types / should_compile / T4178.hs
1 {-# LANGUAGE
2 FlexibleContexts,
3 RankNTypes,
4 TypeFamilies,
5 MultiParamTypeClasses,
6 FlexibleInstances #-}
7
8 -- See #4178
9
10 module T4178 where
11
12 data True = T
13 data False = F
14
15 class Decide tf a b where
16 type If tf a b
17 nonFunctionalIf :: tf -> a -> b -> If tf a b
18
19 instance Decide True a b where
20 type If True a b = a
21 nonFunctionalIf T a b = a
22
23 instance Decide False a b where
24 type If False a b = b
25 nonFunctionalIf F a b = b
26
27 useRank2 :: (forall a . a -> b) -> b
28 useRank2 f = f "foo"
29
30 hasTrouble a = nonFunctionalIf F a (2 :: Int)
31 blurg = useRank2 hasTrouble
32
33 hasNoTrouble :: a -> Int
34 hasNoTrouble = hasTrouble
35 blurg2 = useRank2 hasNoTrouble