Proposal: Bounded instance for IntSet (ticket #1953)

Ross Paterson ross at
Mon Dec 3 20:34:15 EST 2007

On Mon, Dec 03, 2007 at 03:32:52PM +0200, Yitzchak Gale wrote:
> Henning Thielemann wrote:
> > is not sensible to have different instances for the same
> > type and class, because they will collide sooner or later.
> True. That is why libraries should not define an instance
> at all, unless they are quite certain that it is by far the most
> important instance that anyone will ever want to use.

I would draw the opposite conclusion from the same data: if a sensible
instance can be identified, it should accompany either the class or
the type constructor.  If people define orphan instances, they will
eventually collide, even they are identical.  (There are a few orphans in
Control.Monad.Instances, but that is required to preserve compatibility
with Haskell 98.)

But in the case at issue, the proposed Bounded instance is
counter-intuitive because the underlying Ord instance is.  That Ord
instance is an arbitrary choice that is accepted because it allows IntSets
to be used as search keys; it makes no sense on its own.  A Bounded
instance would attach unwarranted significance to this arbitrary ordering.

It might be different if there were a use in sight for the Bounded

More information about the Libraries mailing list