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

Derek Elkins derek.a.elkins at gmail.com
Mon Jan 19 22:18:11 EST 2009


On Mon, 2009-01-19 at 22:12 -0500, S. Doaitse Swierstra wrote:
> 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
> 

My notation is show . read is not less than or equal to id.  That covers
that case.  The particular example I was thinking of was actually simply
whitespace.



More information about the Haskell-Cafe mailing list