[Haskell] [ANNOUNCE]: Ranged Sets

Paul Johnson paul at cogito.org.uk
Sun Dec 11 18:14:46 EST 2005

 From the README:

    Ranged sets allow programming with sets of values that are described 
by a
    list of ranges.  A value is a member of the set if it lies within one of
    the ranges.  The ranges in a set are ordered and non-overlapping, so the
    standard set operations can be implemented by merge algorithms in 
O(n) time.

Obviously you can use this for sets of numbers, including things like 
Double that tend not to fit well into the enumerated membership model of 
conventional set implementations.  But you can also have ranges of 
strings (or any other list of ordered types).  So for example the set of 
all strings from "bar" to "foo" and "BAR" to "FOO" inclusive would be:

   strSet = rangedSet [ Range (BoundaryBelow "bar") (BoundaryAbove "foo"),
      Range (BoundaryBelow "BAR") (BoundaryAbove "FOO")]

Note that this set includes "bar1" but not "foo1".

I've created a SourceForge project for this, although I hope that once 
the library matures it will be included in the Base library package.  
The home page is at


I *think* I've also put the source in CVS, although at present the CVS 
web browser on SourceForge has not caught up with it.


More information about the Haskell mailing list