[Haskell-cafe] About instance

Jules Bean jules at jellybean.co.uk
Tue Jan 18 17:03:05 EST 2005


On 18 Jan 2005, at 21:45, Ulises Juarez Martinez wrote:
> Who can I do an instance of Eq (Ocurrence -> Bool)? Is there another 
> option to avoid the error?
>

In general, you can't define one. To define equality on functions you 
want to check the value on every possible input, and since Ocurrence is 
an infinite type, that can't be done in a finite time.

In this specific case, you are dealing with indicator functions, which 
are isomorphic to (possibly infinite) Sets of Ocurrences. If you happen 
to know that they will always be finite (or, perhaps, always cofinite) 
you might solve the problem by using that representation.

Jules



More information about the Haskell-Cafe mailing list