[Haskell-cafe] Set of reals...?

Stijn De Saeger stijndesaeger at gmail.com
Thu Oct 28 01:57:38 EDT 2004

Thank you, 
I eventually tried to go with this approad, after a few people's
But, like you mentioned in your post, now I find myself needing a
notion of subset relations, and since you obviously can't define
equality over functions, i'm stuck again. Do you know any way around
this problem, or have i hit a dead end...?


On Wed, 27 Oct 2004 10:50:24 +0100, Ben Rudiak-Gould
<benjamin.rudiak-gould at cl.cam.ac.uk> wrote:
> One idea that might not occur to a newcomer is to represent each set by
> a function with a type like (Double -> Bool), implementing the set
> membership operation. This makes set-theoretic operations easy: the
> complement of s is not.s (though watch out for NaNs!), the union of s
> and t is (\x -> s x || t x), and so on. Open, closed, and half-open
> intervals are easy too. The big limitation of this representation is
> that there's no way to inspect a set except by testing particular values
> for membership, but depending on your application this may not be a problem.
> -- Ben

More information about the Haskell-Cafe mailing list