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

-- Pattern match uses dictionaries bound higher up in the pattern

module Main where

data T = forall a. Integral a => T a

f :: T -> Bool
f (T 0) = True
f (T n) = False

g :: T -> Ordering
g (T n) | n >= 3 = if n>3 then GT else EQ
g (T n)     = LT

main = do   print [f (T 0), f (T 1)]
	    print [g (T 2), g (T 3), g (T 4)]