<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 21, 2015 at 7:23 PM, Jeffrey Brown <span dir="ltr"><<a href="mailto:jeffbrown.the@gmail.com" target="_blank">jeffbrown.the@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The following compiles. (Rev stands for Reversible, and Dirn for Direction.)<br><br> class Rev a where<br> rev :: a -> a<br> <br> data Dirn = Succ | Pred<br> deriving (Eq, Show, Ord)<br><br> -- implement Ord<br> (<=) Succ Pred = False<br> (<=) _ _ = True<br></div></blockquote><div><br></div><div>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.</div><div><br></div><div>If you want to implement an instance manually, use the instance keyword.</div><div><br></div><div> instance Ord Dim where</div><div> (<=) Succ Pred = False</div><div> (<=) _ _ = True</div><div><br></div><div>The same applies to Rev later, but in that case it's redefining something defined in the same module and errors out.</div><div><br></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a> <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</div></div>