"Show"ing records with Unicode (Haskell) -


if run following haskell code:

data r = r {μ :: double} deriving show  main = print $ show $ r 3 

we get:

"r {\956 = 3.0}"

what way handle unicode names showing?

print . show show whatever you're printing twice! type signature of print tells you:

 print :: show => -> io () 

so can print instantiates show directly. print . show not necessary!

if show char, escape code non-ascii stuff — design decision. if take 'show'able data type , first use show on it, you're printing not data type itself, string representation given data type's show instance.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -