summaryrefslogtreecommitdiff
path: root/testsuite/tests/quantified-constraints/T2893c.hs
blob: 832d0f8428df7200fd1d02e01fb850c9e0bff88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE QuantifiedConstraints  #-}

module T2893c where

data Rose f x = Rose x (f (Rose f x))

instance Eq a => Eq (Rose f a)  where
  (Rose x1 _) == (Rose x2 _) = x1==x2

-- Needs superclasses
instance (Ord a, forall b. Ord b => Ord (f b))
      => Ord (Rose f a)  where
  (Rose x1 rs1) >= (Rose x2 rs2)
     = x1 >= x2 && rs1 == rs2
  a <= b = False  -- Just to suppress the warning