-3

Sorry if this is a stupid question but does anyone know of a function which would allow me to enclose a number in quotation marks in Haskell, for example:

function 7777 -> "7777"

function 1234 -> "1234"

Thanks for any help :)

Michael
  • 83
  • 1
  • 2
  • 8

1 Answers1

1

Do you mean, convert 7777 to a string? You can use show.

show 7777 --> "7777"

If you then want quotes around that string do:

"\"" ++ show 7777 ++ "\""
seanmcl
  • 9,740
  • 3
  • 39
  • 45
  • erm... At the moment my output from one function is a number, the next function I want to implement (on this number) requires that the number is surrounded by quotation marks, so I want a function that does this so I can combine all three into a single operation, if that makes sense? – Michael Aug 27 '13 at 15:51
  • 1
    `A number surrounded in quotation marks` Do you mean a string? – daniel gratzer Aug 27 '13 at 15:54
  • @Michael that should be a String, you can check in GCHi by using `:t yourfunction` – jk. Aug 27 '13 at 15:56
  • it's Int -> [e] -> [[e]] – Michael Aug 27 '13 at 16:01