RE: Haskell report typo (bad law for readsPrec)

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