AddBounds makes total orders from total orders. It just adds new least and greatest elements.<br><br>The problem with the derived instance is that it doesn't exploit the potential laziness of min on 'a'. Because of their types, min it can produce partial info from partial info and (<=) and compares cannot.<br>
<br> - Conal<br><br><div class="gmail_quote">On Thu, Mar 20, 2008 at 2:00 AM, Christian Maeder <<a href="mailto:Christian.Maeder@dfki.de">Christian.Maeder@dfki.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Conal Elliott wrote:<br>
> I have an algebraic data type (not newtype) that derives Ord:<br>
><br>
> data AddBounds a = MinBound | NoBound a | MaxBound<br>
> deriving (Eq, Ord, Read, Show)<br>
<br>
</div>The class Ord is not suited for partial orders. If you write your own<br>
Ord instances anyway, I'd suggest to introduce a proper new class (say<br>
Lattice), too!<br>
<br>
I hope that the computation of "uncomparable" does terminate in your<br>
case. Maybe the lattice operation "join and "meet" are even more<br>
appropriate than "min" and "max".<br>
<br>
However, if your type parameter "a" has a total order, the above derived<br>
instance looks correct.<br>
<br>
HTH Christian<br>
<br>
</blockquote></div><br>