
On Wed, Jan 21, 2015 at 7:23 PM, Jeffrey Brown
The following compiles. (Rev stands for Reversible, and Dirn for Direction.)
class Rev a where rev :: a -> a
data Dirn = Succ | Pred deriving (Eq, Show, Ord)
-- implement Ord (<=) Succ Pred = False (<=) _ _ = True
You derived Ord; why are you doing this? You are locally overriding the Ord instance you derived with a (<=) that is *not* the one that is part of Ord.. and will therefore not contribute to the other functions from Ord. If you want to implement an instance manually, use the instance keyword. instance Ord Dim where (<=) Succ Pred = False (<=) _ _ = True The same applies to Rev later, but in that case it's redefining something defined in the same module and errors out. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net