summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc166.hs
blob: 5739a347c8209b6bad2a1e1018f5ebbd744b762e (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
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
             ExistentialQuantification, RankNTypes,
             FlexibleInstances #-}

-- Arguably, the type signature for f1 should be enough to make
-- this program compile, but in 5.04 it wasn't; the
-- extra sig in f2 was needed.
--
-- This is a pretty borderline case.

module ShouldCompile where

    class C t a b | t a -> b
    instance C Char a Bool

    data P t a = forall b. (C t a b) => MkP b

    data Q t = MkQ (forall a. P t a)

    f1 :: Q Char
    f1 = MkQ (MkP True)

    f2 :: Q Char
    f2 = MkQ (MkP True :: forall a. P Char a)