Hello everyone, I’m trying to use show
to turn a character 'z'
into a string "z"
in Haskell.
I try :
show 'z'
and Haskell give me :
"'z'"
This really makes me confused because in Haskell we have :
"z" == 'z' : []
But
"'z'" == '\'' : 'z' : '\'' : []
This confuses me because show
function looks like breaks the expression into minimal parts and add parts into a list one by one with respect to the order and 'z'
can’t be decomposed since it mean character z
.
I think it’s natural to expect show 'z'
to be "z"
since show
maps things to a string, but I don’t why Haskell doesn’t define show
like that.