summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/data2.hs
blob: fcac05880b3ee5c9ea63f3b95ea83cffd5005a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE GADTs, ExistentialQuantification #-}

-- Trac #289

module ShouldCompile where

class Foo a where
  foo :: a -> Int

data T = forall a. T (G a)
data G a where
  A :: G a
  B :: Foo a => a -> G a

doFoo :: T -> Int
doFoo (T A) = 2
doFoo (T (B x)) = foo x