summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/data2.hs
blob: 5b8a009d058d47615cb7a34332920ff6fba8103c (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