[Haskell-cafe] Re: Haskell and C++ program

S. Doaitse Swierstra doaitse at swierstra.net
Mon Jan 19 22:12:31 EST 2009


On 17 jan 2009, at 22:22, Derek Elkins wrote:

> On Thu, 2009-01-15 at 13:40 +0100, Apfelmus, Heinrich wrote:
>> Eugene Kirpichov wrote:
>>> Well, your program is not equivalent to the C++ version, since it
>>> doesn't bail on incorrect input.
>>
>> Oops. That's because my assertion
>>
>>   show . read = id
>>
>> is wrong. We only have
>>
>>   read . show  = id
>>   show . read <= id  (in the "less defined than" sense)
>
> No, you only have
> read . show = id which often doesn't hold in practice.
> show . read </= id

You do not even have that; the read may remove surplus parentheses  
which will not be reinserted by the show.

  Doaitse


>
>
> Assuming the first identity holds, you do of course have show . read .
> show = show and this probably holds even in most cases where read .  
> show
> = id does not hold.
>
>
> _______________________________________________
> 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