Here-docs in Haskell source

Alistair Bayley alistair at abayley.org
Fri Sep 22 08:45:56 EDT 2006


Apologies if this has been covered already... I've searched the
haskell-prime list archive and not found anything on this.

I'd like to submit a request for a fairly trivial feature: multi-line
text literals in source, AKA here-docs. You know, like the
ruby/perl/bash <<EOD...EOD, or python's triple-quotes, or C#'s @"...".

My motivation: primarly for embedding SQL statements in program text.
I'm sure there are plenty of other uses...

I'm aware of the trailing-\-leading-\ option, but IMHO that's almost
on a par with ++ ".." for usability: if you have a chunk of text you
need to paste into your program as a text literal, you must modify
every line. I know this can be automated, but it's still an extra
step,
and if you need to extract it for editing, you have to strip off the
surrounding crud.

Here's an old related thread, but I can't tell if some conclusion was reached:
http://www.mail-archive.com/haskell-cafe@haskell.org/msg01343.html

Alistair


More information about the Haskell-prime mailing list