Show is supposed to convert its argument into a haskell expression which, when evaluated, returns the same value that was initially passed to show.  So by this definition, "\252" is just as correct  as "ü".

There are some Show instances out in the world that do not follow this rule, but they are bad.  I'm looking at you, Network.URI!


On Wed, Mar 5, 2014 at 2:20 PM, <k@ioctl.it> wrote:
Okay, it makes somewhat more sense now after reading that thread. But technically, why does 
 
show "ü" 
 
not handle Unicode? Isn't the internal representation of [Char] actually still Unicode, as per 
 
http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Char.html
 
Thanks!
 
k
 
 
On Wed, Mar 5, 2014, at 01:46 PM, Clark Gaebel wrote:
"Show" is for debug output. It's not a generic "to_string". See this thread [1] from last week for more info.
 
  - Clark
 
 
 
On Wed, Mar 5, 2014 at 4:43 PM, <k@ioctl.it> wrote:
Hello!
 
I'm sure this has been answered many times before, but I can't find an
explanation for this behavior anywhere. The question I have is a general
one regarding 'show'. Why does
 
main = do
    putStrLn "ü"
 
➜  ~ runhaskell test.hs
ü
 
 
and:
 
main = do
    putStrLn $ show "ü"
 
➜  ~ runhaskell test.hs
"\252"
 
Thank you all for an enlightening answer already!
 
Best,
 
k
_______________________________________________
Haskell-Cafe mailing list
 
 
 
 
--
Clark.
 
Key ID     : 0x78099922
Fingerprint: B292 493C 51AE F3AB D016  DD04 E5E3 C36F 5534 F907

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe