[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / interpreter / test / runtime / r003.hs
1 -- test for derived Ord instances
2
3 module TestOrd where
4
5 data T = C1 | C2 deriving (Eq, Ord)
6
7 cmps :: [T -> T -> Bool]
8 cmps = [ (<), (<=), (==), (/=), (>=), (>) ]
9
10 -- kind of a reversed zipWith...
11 rzipWith :: [a -> b -> c] -> a -> b -> [c]
12 rzipWith fs a b = [ f a b | f <- fs ]
13
14 --!!! Testing derived Ord and Eq instances for enumeration type
15 test1 = rzipWith cmps C1 C1 -- should be [F,T,T,F,T,F]
16 test2 = rzipWith cmps C1 C2 -- should be [T,T,F,T,F,F]
17 test3 = rzipWith cmps C2 C1 -- should be [F,F,F,T,T,T]
18