not quite the same issue, but you might be interested by http://people.cs.uu.nl/stefan/blog/00012.html which notes: Prelude> let apply = \f x -> f x Prelude> let apply' = \f -> f Prelude> apply undefined `seq` () () Prelude> apply' undefined `seq` () *** Exception: Prelude.undefined mulling this over helped me think about functions that were similar but had different numbers of params. (the first only takes a function as its first arg, the second, which I believe is the same as "id" takes anything.) t. PR Stanley <prstanley@ntlworld.com> Sent by: haskell-cafe-bounces@haskell.org 10/15/2007 06:56 PM To haskell-cafe@haskell.org cc Subject [Haskell-cafe] Equality Question Hi is const = id? const 'x' 'y' 'x' id 'x' 'x' Cheers, Paul _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
a good sanity check for saneness of two fxs is to "quickcheck" them, as I believe I provided an example to for a previous question of yours. Though I think in this case that's impossible because, as someone else pointed out, not even the function tyes agree. t. PR Stanley <prstanley@ntlworld.com> Sent by: haskell-cafe-bounces@haskell.org 10/15/2007 06:56 PM To haskell-cafe@haskell.org cc Subject [Haskell-cafe] Equality Question Hi is const = id? const 'x' 'y' 'x' id 'x' 'x' Cheers, Paul _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (5)
-
Bryan O'Sullivan -
Dan Weston -
Felipe Lessa -
PR Stanley -
Thomas Hartman