Haskell report typo (bad law for readsPrec)

Simon Peyton-Jones simonpj@microsoft.com
Mon, 25 Jun 2001 00:38:01 -0700


The Haskell report is far from a precise document, and now is
not the time to make it so.

Nevertheless, Wolfgang has a point, and I have slid a little way
into this tar pit by making a change at all.

OK, I think I buy this formulation:

       head (readsPrec d (showsPrec d x "")) =3D=3D (x,"")

(I suppose I might say "provided x is a total value").

Simon "desperately trying to freeze the report" PJ

| -----Original Message-----
| From: Wolfgang Lux [mailto:lux@wi.uni-muenster.de]=20
| Sent: 20 June 2001 10:30
| To: Patrik Jansson
| Cc: haskell-cafe@haskell.org
| Subject: Re: Haskell report typo (bad law for readsPrec)=20
|=20
|=20
| Patrik Jansson wrote
|=20
| > [Typo - you mean:]
| >       head (readsPrec d (showsPrec d x "")) =3D=3D (x,"")
|=20
| Yes.
|=20
| > Both formulations look OK to me, but neither is an essential change=20
| > and there are many other small variations possible with slight=20
| > semantical differences. One example is
| >=20
| >       (x,"") `elem` readsPrec d (showsPrec d x "")
| >=20
| > And already the current (proposed) formulation is most likely=20
| > impossible to satisfy if the element x contains bottoms somewhere=20
| > inside. (Example: try to show and read the string (undefined :=20
| > "hello").)
|=20
| True, but in any case it seems sensible to me to require that=20
| readsPrec should actually process the input string. With your proposal
|=20
| > > |      fst (head (readsPrec d (showsPrec d x ""))) =3D=3D x
|=20
| it would be possible to return [(42,"42")] for the expression=20
| readsPrec 0 (showsPrec 0 42 "").
|=20
| Wolfgang
|=20
|=20
|=20
| --
| Wolfgang Lux				  Phone: +49-251-83-38263
| Institut fuer Wirtschaftinformatik	    FAX: +49-251-83-38259
| Universitaet Muenster		      Email: wlux@uni-muenster.de
|=20
|=20
|=20
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe@haskell.org=20
| http://www.haskell.org/mailman/listinfo/haskell-cafe
|=20