[Haskell-cafe] General function to count list elements?
bugfact at gmail.com
Sun Apr 19 19:00:19 EDT 2009
Or a StableName? I guess StablePtr prevents the GC to move the Haskell
object, so for just doing ugly comparing StableName would be better?
On Mon, Apr 20, 2009 at 12:45 AM, Lennart Augustsson <lennart at augustsson.net
> And when the need gets big enough you pull out StablePtr and use that. :)
> On Sun, Apr 19, 2009 at 10:43 PM, Peter Verswyvelen <bugfact at gmail.com>
> > Sometimes I do miss the pragmatic C solution:
> > - two function pointers that are equal surely represent the same
> > (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
> > On Sat, Apr 18, 2009 at 6:02 PM, John A. De Goes <john at n-brain.net>
> >> 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
> >> to implement in a useful way, and impossible to implement in a perfect
> >> 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
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe