
The new QuasiQuotes extension arriving with ghc 6.10 is very exciting, and handling multi-line string literals is like stealing candy from a baby. ;) ----------------------------------------------------------------------------- -- Here.hs module Here (here) where import Language.Haskell.TH.Quote import Language.Haskell.TH.Syntax import Language.Haskell.TH.Lib here :: QuasiQuoter here = QuasiQuoter (litE . stringL) (litP . stringL) ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- There.hs {-# LANGUAGE QuasiQuotes #-} module Main where import Here (here) main = putStr [$here| Shall I say, I have gone at dusk through narrow streets And watched the smoke that rises from the pipes Of lonely men in shirt-sleeves, leaning out of windows? I should have been a pair of ragged claws Scuttling across the floors of silent seas. |] ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- [m@ganon a]$ ghc -O2 --make There.hs [1 of 2] Compiling Here ( Here.hs, Here.o ) [2 of 2] Compiling Main ( There.hs, There.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package syb ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package packedstring-0.1.0.1 ... linking ... done. Loading package containers-0.2.0.0 ... linking ... done. Loading package pretty-1.0.1.0 ... linking ... done. Loading package template-haskell ... linking ... done. Linking There ... [m@ganon a]$ ./There Shall I say, I have gone at dusk through narrow streets And watched the smoke that rises from the pipes Of lonely men in shirt-sleeves, leaning out of windows? I should have been a pair of ragged claws Scuttling across the floors of silent seas. [m@ganon a]$ -----------------------------------------------------------------------------