[Haskell-cafe] Equality Question

Dan Weston westondan at imageworks.com
Tue Oct 16 15:26:58 EDT 2007


Your intuition that id is related to const is a good one, since id can 
be defined in terms of const. Here is one of many:

id' = flip const const

[This is also called a CKK combinator. See 
http://en.wikipedia.org/wiki/S_combinator#Combinatory_calculi for more 
examples, such as SKK, SKS, and various other identity equivalents.]

Whether these are "different" identity functions is an interesting 
question. Ask yourself how you could tell them apart. What if they both 
always gave the same answer, but one always took longer than the other? 
Are you allowed to "peek at the code" before deciding on equality? Does 
it even matter whether there is only one identity? [AKA, is function 
application faithful?] Interesting stuff. More at:

http://en.wikipedia.org/wiki/Semiautomaton

Dan

PR Stanley wrote:
> Hi
> is const = id?
> const 'x' 'y'
> 'x'
> id 'x'
> 'x'
> 
> Cheers,
> Paul
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 




More information about the Haskell-Cafe mailing list