[Haskell-cafe] "show" for functional types

Brian Hulley brianh at metamilk.com
Sat Apr 1 15:23:03 EST 2006


Robert Dockins wrote:
> [snip]
> From an earlier post:
>
>>> Now since f and g compute the same results for the same inputs,
>>> anywhere in a program that you can use f you could just replace f
>>> by g and the observable behaviour of the program would be
>>> completely unaffected. This is what referential transparency means.
>
> My essential claim is that the above statement is in error (but in a
> fairly subtle way).

Ok I see now! :-) I was confusing the concept of referential transparency 
with a kind of global code equivalence, so the rest of my argument is 
irrelevant. Thus I should have said:

" For particular types T1 and T2, if (f (x::T1))::T2 === g x for all x in T1 
then f :: T1->T2 and g ::T1->T2 can be freely substituted since the context 
T1->T2 cannot tell them apart."

Thanks for pointing out the faulty definition,

Regards, Brian. 



More information about the Haskell-Cafe mailing list