summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/gadt/gadt18.hs
blob: 4ac12efa849a6e0b3cbe88cb90d7900c6694fa61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE GADTs #-}
-- A simple GADT test from Roman
-- which nevertheless showed up a bug at one stage

module ShouldCompile where

data T a where
  T1 :: () -> T ()
  T2 :: T a -> T b -> T (a,b)

class C a where
  f :: T a -> a

instance C () where
  f (T1 x) = x

instance (C a, C b) => C (a,b) where
  f (T2 x y) = (f x, f y)