Proposal: Bounded instance for IntSet (ticket #1953)

kahl at kahl at
Mon Dec 3 11:37:49 EST 2007

Yitzchak Gale wrote:
 > Unfortunately, there is still no way to control export
 > of instances. 

I have some modules that do nothing but export instances ---
I even make the empty export list explicit...

 > In this case, the Ord instance is not really natural; it is defined
 > for technical reasons for use by the library itself (and its
 > friends). The library has no need for a Bounded instance, so why
 > should we prevent people from defining one for some other purpose?

Whereever this Ord instance is in scope,
a Bounded instance has to conform with that.

It even makes sense to define the Bounded instance
for the explicit purpose of preventing people to roll their own
semantically inconsistent Bounded instances,
especially since the correct instance is obviously somewhat non-obvious ;-)

One could of course consider to put both instances
into a separate module Data.IntMap.Ord,
so you can choose not to import that
and roll your own instead.


More information about the Libraries mailing list