I was wondering if I can convert a string to a list of characters?
\"jt5x=!\" -> [\"j\",\"t\",\"5\",\"x\",\"=\",\"!\"]
Essentially, it w
(Collecting comments into an answer)
Because in haskell, a String
is a list of characters, i.e. [Char]
, just returning the input as given will do.
example = id
does what you want. Note that id
is defined as
id x = x
Your example "jt5x=!" -> ["j","t","5","x","=","!"]
does not match the description: Double quotes ""
enclose String
s not single Char
acters. For characters use single quotes '
. You can type
"jt5x=!" == ['j','t','5','x','=','!']
into GHCi and see it returns True
. Type map (:[]) "jt5x=!"
to actually see ["j","t","5","x","=","!"]
.