[Haskell-cafe] Serialization of (a -> b) and IO a

Dan Doel dan.doel at gmail.com
Thu Nov 11 17:28:00 EST 2010

On Thursday 11 November 2010 12:34:21 pm John Lato wrote:
> 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.

In general, it doesn't even have to be based on a mathematical identity. As 
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 

You cannot factor out or inline subexpressions or without the difference being 
observable (presumably) by serialize.

-- Dan

More information about the Haskell-Cafe mailing list