Re: [Haskell-cafe] Equality Question
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 [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 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.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Equality Question
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 [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 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.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Equality Question
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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[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
Re: [Haskell-cafe] Equality Question
On 10/15/07, PR Stanley [EMAIL PROTECTED] wrote: Hi is const = id? You answered the question yourself const 'x' 'y' 'x' id 'x' 'x' const has another parameter. Their types are id:: a - a const :: a - b - a HTH, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Equality Question
PR Stanley wrote: is const = id? No, const is saturated with 2 arguments, id with 1. const 1 2 - 1 id 1 2 - type error b ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe