summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Pedro Magalhaes <jpm@cs.ox.ac.uk>2012-06-21 12:49:44 +0100
committerJose Pedro Magalhaes <jpm@cs.ox.ac.uk>2012-06-21 12:49:44 +0100
commit488f34cf98f8d147ca4f9292925f0337d2ee2332 (patch)
tree49429212c51de0fd88a0ad217cfcc05dfb86a78c
parent7d8b524178e759f3ef7edf5e2ffb6e5f0a35b500 (diff)
downloadhaskell-488f34cf98f8d147ca4f9292925f0337d2ee2332.tar.gz
Add one of Reiner Pope's tests for #5936
-rw-r--r--testsuite/tests/generics/GEq/GEq1.hs14
-rw-r--r--testsuite/tests/generics/GEq/GEq1.stdout1
2 files changed, 13 insertions, 2 deletions
diff --git a/testsuite/tests/generics/GEq/GEq1.hs b/testsuite/tests/generics/GEq/GEq1.hs
index 01dedecdf2..164535cddb 100644
--- a/testsuite/tests/generics/GEq/GEq1.hs
+++ b/testsuite/tests/generics/GEq/GEq1.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TypeOperators, DeriveGeneric #-}
+{-# LANGUAGE TypeOperators, DeriveGeneric, TypeFamilies, FlexibleInstances #-}
module Main where
@@ -16,6 +16,10 @@ data D a = D0 | D1 { d11 :: a, d12 :: (D a) }
data (:**:) a b = a :**: b
deriving Generic
+data family F a b :: * -> *
+data instance F Int b c = F b Int c
+ deriving Generic
+
-- Example values
c0 = C0
c1 = C1
@@ -27,15 +31,21 @@ d1 = D1 'p' D0
p1 :: Int :**: Char
p1 = 3 :**: 'p'
+f1 :: F Int Float Char
+f1 = F 0.0 3 'h'
+f2 = F 0.0 4 'h'
+
-- Generic instances
instance GEq C
instance (GEq a) => GEq (D a)
instance (GEq a, GEq b) => GEq (a :**: b)
+instance (GEq b, GEq c) => GEq (F Int b c)
-- Tests
teq0 = geq c0 c1
teq1 = geq d0 d1
teq2 = geq d0 d0
teq3 = geq p1 p1
+teq4 = geq f1 f2
-main = mapM_ print [teq0, teq1, teq2, teq3]
+main = mapM_ print [teq0, teq1, teq2, teq3, teq4]
diff --git a/testsuite/tests/generics/GEq/GEq1.stdout b/testsuite/tests/generics/GEq/GEq1.stdout
index a7f0546170..3ce45b831d 100644
--- a/testsuite/tests/generics/GEq/GEq1.stdout
+++ b/testsuite/tests/generics/GEq/GEq1.stdout
@@ -2,3 +2,4 @@ False
False
True
True
+False