On Thu, Nov 11, 2010 at 10:28 PM, Dan Doel <dan.doel@gmail.com> wrote:
On Thursday 11 November 2010 12:34:21 pm John Lato wrote:In general, it doesn't even have to be based on a mathematical identity. As
> I think the only way this would work would be if you consider functions to
> be equal only to themselves, i.e. "x+x" and "2*x" are not equal. That's
> not a trade-off I would be willing to make.
has been stated, this would in general simply break referential transparency.
Are these two functions equal:
f x = k (h x) (h x)
g x = let y = h x in k y y
Presumably, no, if serialize exists (and they may have different performance
characteristics).
You cannot factor out or inline subexpressions or without the difference being
observable (presumably) by serialize.