summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/gadt18.hs
blob: a7ae5a20c537bfb1afb28b8a405b9e9687594ead (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)