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

Claus Reinke claus.reinke at talk21.com
Mon Apr 16 09:18:02 EDT 2007


> 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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Here.hs
Type: application/octet-stream
Size: 939 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070416/eeb308cc/Here.obj


More information about the Haskell-Cafe mailing list