hadrian: Add support for bindist compressors other than Xz
[ghc.git] / testsuite / tests / typecheck / should_compile / T7891.hs
1 {-# LANGUAGE RankNTypes #-}
2 {-# LANGUAGE TypeFamilies #-}
3 {-# OPTIONS_GHC -O #-} -- -O casused a Lint error in the simplifier, so I'm putting that in
4 -- all the time, so we don't miss it in a fast validate
5
6 module T7891 where
7
8 import Data.Kind (Type)
9
10 newtype T = T (forall t. t -> t)
11
12 tf :: T
13 tf = T id
14
15 -- Can't write this type signature:
16 f :: t -> t
17 T f = tf
18
19 -- But with an indirection we can:
20 g :: t -> t
21 g = f
22
23 -- We can still use f as it were fully polymorphic (which is good):
24 a :: ()
25 a = f ()
26 b :: Char
27 b = f 'b'
28
29 -------------
30
31 class C t where
32 data F t :: Type
33 mkF :: t -> F t
34
35 instance C () where
36 data F () = FUnit (forall t. t -> t)
37 mkF () = FUnit id
38
39 -- Can't write a type for f here either:
40 k :: t -> t
41 FUnit k = mkF ()