[Haskell-cafe] Re: Translating perl -> haskell, string "fill ins" with an error on invalid inputseems awfullycomplex.Is there a way to simplify?

Thomas Hartman tphyahoo at gmail.com
Mon Apr 16 09:58:11 EDT 2007


I put this on the haskell wiki at

http://haskell.org/haskellwiki/Poor_Man%27s_Heredoc_in_Haskell

So far I have only linked this from
http://haskell.org/haskellwiki/Simple_unix_tools

I feel like the wiki deserves a section on "Haskell Template
Solutions" distinct from this. However, there is a bit of a namespace
conflict, as "template haskell" is a ghc extension, and so if you
google on it you will get all stuff first.

I wonder if anyone has an opinion on a good title for a wiki page about this.

Haskell String Interpolation?
Haskell String Templates?

But these sound clunky to me.

2007/4/16, Claus Reinke <claus.reinke at talk21.com>:
> > With regards to the variable interpolation in strings problem, ..
>
> as i mentioned, it is not difficult to hack something up, and in many cases,
> efficiency doesn't matter much for this part of the problem (though a standard,
> efficient, well-designed library would be welcome). but if we compare the attached
> example with here docs in perl or shell or .., we find that we can get rid of all that
> escaping and concatenation in strings, but:
>
>     - the file name should be implicit (the current source)
>     - the dictionary should be implicit (the current variable environment)
>
> the former might be easy to add to the language, and the latter would be a minor
> subset of template haskell functionality. but they need to be standardized and
> widely available to be of much use.
>
> claus
>
> ps here's the output:
>
> $ runhaskell Here.hs
>
> this is a poor man's here-document
>
> with quotes ", and escapes \,
> and line-breaks, and layout
> without escaping \" \\ \n,
> without concatenation.
>
> oh, and with some variables, $(too).
>
>
>
> <html>
> <head><title>very important page</title></head>
> <body>
> <verb>
>
> this is a poor man's here-document
>
> with quotes ", and escapes \,
> and line-breaks, and layout
> without escaping \" \\ \n,
> without concatenation.
>
> oh, and with some variables, $(too).
>
>
> </verb>
> </body>
> </html>
>
>


More information about the Haskell-Cafe mailing list