[Haskell-cafe] General function to count list elements?
Peter Verswyvelen
bugfact at gmail.com
Sun Apr 19 16:43:34 EDT 2009
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 <john at n-brain.net> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090419/8ec1a1a5/attachment.htm
More information about the Haskell-Cafe
mailing list