
20 Mar
2008
20 Mar
'08
5 a.m.
Conal Elliott wrote:
I have an algebraic data type (not newtype) that derives Ord:
data AddBounds a = MinBound | NoBound a | MaxBound deriving (Eq, Ord, Read, Show)
The class Ord is not suited for partial orders. If you write your own Ord instances anyway, I'd suggest to introduce a proper new class (say Lattice), too! I hope that the computation of "uncomparable" does terminate in your case. Maybe the lattice operation "join and "meet" are even more appropriate than "min" and "max". However, if your type parameter "a" has a total order, the above derived instance looks correct. HTH Christian