Proposal: Bounded instance for IntSet (ticket #1953)
John Meacham
john at repetae.net
Sun Dec 2 19:37:23 EST 2007
On Sun, Dec 02, 2007 at 03:45:40PM -0800, David Benbennick wrote:
> >From http://hackage.haskell.org/trac/ghc/ticket/1953 :
>
> I propose to add a Bounded instance to IntSet.hs.
>
> IntSet is in Ord, and there are only finitely many instances of
> IntSet. Therefore there is a min IntSet and a max IntSet. It turns out
> these bounds are very simple:
>
> instance Bounded IntSet where
> minBound = empty
> maxBound = singleton maxBound
This seems fairly unintuitive me. the natural choices of minimum and
maximum bounds for a set would seem to be
singleton minBound vs singleton maxBound
or
empty vs universal (fromList [minBound .. maxBound]) set
the odd combination of the two proposed just feels off to me.
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Libraries
mailing list