Get backslash containing string

I would like to create a variable that includes a backslash, such as ("\abc", “\123”, and so on).

Currently, this code putStrLn $ showString "\\abc" [] prints \abc, but I would like to assign it to a variable instead.

Can anyone assist me with this?

1 Like

Here’s an example of binding a string to a variable and then printing it:

main =
  let x = "\\abc" in
  putStrLn x
2 Likes