
Hi, Thomas-- At 10:01 AM +0000 8/4/03, you wrote:
Is there any reason why show :: String -> String is not equivalent to 'id' ?
At the moment,
show "one" = "\"one\""
which leads to problems because it often requires String to be treated as a special case, rather than just a member of Show.
Tom _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Actually, this definition of show :: String -> String is consistent with the definitions of show for other familiar types. That is, it produces the string by which its argument's value would be represented as a literal value in Haskell code. A String literal is enclosed in quotation marks, and characters such as new-lines, tabs, and quotation marks are represented by \-sequences. Ergo, the first and last characters of the value of (show (x::String)) are always quotation marks, and each newline, tab, or quotation mark in x will appear in (show x) as a two-character \-sequence. I'm not sure what you mean by "... requires String to be treated as a special case, rather than just a member of Show". What sort of special treatment did you have in mind? Regards, --Ham -- ------------------------------------------------------------------ Hamilton Richards, PhD Department of Computer Sciences Senior Lecturer The University of Texas at Austin 512-471-9525 1 University Station C0500 Taylor Hall 5.138 Austin, Texas 78712-1188 ham@cs.utexas.edu hrichrds@swbell.net ------------------------------------------------------------------