Sometimes I do miss the pragmatic C solution:- two function pointers that
are equal surely represent the same functions (although in C nothing is
really sure ;)
- two function pointers that are different, might or might not represent
that same functions.

But this weak equality can sometimes be handy.

For example, suppose you have a predicate a -> Bool, and a list of these
predicates [a -> Bool], but you want to remove all functions that are
obviously equal in the C way from the list for optimization... Okay big
hack, and one could do this already with reallyUnsafePtrEquality# I guess...

On Sat, Apr 18, 2009 at 6:02 PM, John A. De Goes <[email protected]> wrote:

>
> Two functions are equal iff they have the same domain and range and the
> same outputs for the same inputs. Simple to state, but extremely difficult
> to implement in a useful way, and impossible to implement in a perfect way.
>
> If you had a compiler or algorithm capable of determining function
> equality, you could use it to prove or disprove arbitrary theorems in
> mathematics.
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to