Ticket 996: Add ranged sets

Ross Paterson ross at soi.city.ac.uk
Sat Nov 11 07:52:28 EST 2006


On Sat, Nov 11, 2006 at 10:59:41AM +0000, Paul Johnson wrote:
> The ticket is at http://hackage.haskell.org/trac/ghc/ticket/996
> 
> Ranged sets represent sets of ordered values as lists of ranges. Each 
> range has a lower and upper boundary, and for any value and boundary the 
> value is either above or below the boundary: no value can ever sit on a 
> boundary. There are also boundaries for +/- infinity

A few fairly superficial comments:

(This would have been easier to read as a single patch.)

This code could easily be made Haskell 98:

- Data.Ranged.Boundaries includes an instance

	instance DiscreteOrdered Rational

  which would be better generalized to

	instance Integral a => DiscreteOrdered (Ratio a)

- There are a few pattern type annotations, which could be removed:
  - in instance Arbitrary (Range v), superfluous
  - in QuickCheck properties, use signatures instead
    (It's also more common for QuickCheck properties to have separate
    arguments instead of tuple arguments)

Data.Ranged.Ranges has -cpp, but this seems unused

Since this is basically Haskell 98, and is cleanly separated from the
modules of base, it looks like a prime candidate for a separate package,
especially as the plan is to slim down base package (#710).



More information about the Libraries mailing list