Commit 488f34cf authored by jpm@cs.ox.ac.uk's avatar jpm@cs.ox.ac.uk

Add one of Reiner Pope's tests for #5936

parent 7d8b5241
{-# 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]
......@@ -2,3 +2,4 @@ False
False
True
True
False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment