summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T18323.hs
blob: 5f47d783ea5c19ccb89f58e2ad6114881e733148 (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
{-# LANGUAGE ImpredicativeTypes #-}

-- Tests SPECIAL CASE 2 in GHC.Tc.Gen.Bind.tcMonoBinds
-- See Note [Special case for non-recursive pattern bindings]
--
-- Doesn't have any useful effect until we have
-- ImpredicativeTypes, but does no harm either

module T18323 where

ids :: [forall a. a -> a]
ids = [id]

combine :: (forall a . [a] -> a)
        -> [forall a. a -> a]
        -> ((forall a . [a] -> a), [forall a. a -> a])
combine x y = (x,y)

-- This works
works = let t = combine head ids
        in (fst t) (snd t) True

-- But this does not typecheck, and it could
breaks = let (x,y) = combine head ids
         in x y True

-- And nor does this, but it could too
breaks2 = let (t) = combine head ids
          in (fst t) (snd t) True