
Is there any support for multi-line string literals in Haskell? I've done a web search and come up empty. I'm thinking of using Haskell to generate web pages and having multi-line strings would be very useful. Mike

On Wed, 11 Jan 2006, Michael Vanier wrote:
Is there any support for multi-line string literals in Haskell? I've done a web search and come up empty. I'm thinking of using Haskell to generate web pages and having multi-line strings would be very useful.
Do you mean unlines ["first line", "second line", "third line"] ?

On Jan 12, 2006, at 1:34 AM, Henning Thielemann wrote:
On Wed, 11 Jan 2006, Michael Vanier wrote:
Is there any support for multi-line string literals in Haskell? I've done a web search and come up empty. I'm thinking of using Haskell to generate web pages and having multi-line strings would be very useful.
Do you mean
unlines ["first line", "second line", "third line"]
The original poster probably meant something like this: let foo = "This is a long string Which does not end until the matching end quote." Common Lisp has strings like this. Quite convenient whenever you're communicating using lots of strings of data. For example, when running as a cgi script. Thanks, Jason

On Thu, 12 Jan 2006, Jason Dagit wrote:
On Jan 12, 2006, at 1:34 AM, Henning Thielemann wrote:
On Wed, 11 Jan 2006, Michael Vanier wrote:
Is there any support for multi-line string literals in Haskell? I've done a web search and come up empty. I'm thinking of using Haskell to generate web pages and having multi-line strings would be very useful.
Do you mean
unlines ["first line", "second line", "third line"]
The original poster probably meant something like this:
let foo = "This is a long string
Which does not end until the matching end quote."
I don't see the need for it, since unlines [ "first line", "second line", "third line"] works as well.

On 1/12/06, Henning Thielemann
On Thu, 12 Jan 2006, Jason Dagit wrote:
On Jan 12, 2006, at 1:34 AM, Henning Thielemann wrote:
On Wed, 11 Jan 2006, Michael Vanier wrote:
Is there any support for multi-line string literals in Haskell? I've done a web search and come up empty. I'm thinking of using Haskell to generate web pages and having multi-line strings would be very useful.
Do you mean
unlines ["first line", "second line", "third line"]
The original poster probably meant something like this:
let foo = "This is a long string
Which does not end until the matching end quote."
I don't see the need for it, since
unlines [ "first line", "second line", "third line"]
works as well.
Nevertheless Haskell supports multiline strings (although it seems like a lot of people don't know about it). You escape it using \ and then another \ where the string starts again. str = "multi\ \line" Prelude>str "multiline" /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862
participants (4)
-
Henning Thielemann
-
Jason Dagit
-
Michael Vanier
-
Sebastian Sylvan