summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc157.hs
blob: 57c1b99ae829e22ebec251ba0f28d1bf726b3374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE RankNTypes #-}

-- Test silly type synonyms

module ShouldCompile where

type C u a = u  -- Note 'a' unused

foo :: (forall a. C u a -> C u a) -> u
foo x = undefined x

bar :: Num u => u
bar = foo (\t -> t + t)
-- The (Num u) should not get trapped inside the
-- /\a-abstraction which the compiler constructs for
-- the arg to foo.  But it might because it's Num (C u a)!

-- This test tickles a bizarre corner case documented
-- as [Silly Type Synonym] in GHC.Tc.Utils.TcMType