It doesn't appear to, however it isn't hard to add the feature yourself. lt
is just a QuasiQuoter
, which is the data type:
QuasiQuoter {
quoteExp :: String -> Q Exp
, quotePat :: String -> Q Pat
, quoteType :: String -> Q Type
, quoteDec :: String -> Q [Dec]
}
They take a String
, and return the appropriate template haskell type (depending on the context it is used in.
It is a simple matter to transform a string so it works as you described with a regex:
stripWhiteSpaceBeforeBackslash :: String -> String
stripWhiteSpaceBeforeBackslash str = subRegex (mkRegex "^[[:space:]]*\\\\") str ""
Also, a function that transforms a QuasiQuoter
with a string transform function is simple:
transformQuasiQuoter :: (String -> String) -> QuasiQuoter -> QuasiQuoter
transformQuasiQuoter transform quasi = QuasiQuoter {
quoteExp = (quoteExp quasi) . transform
, quotePat = (quotePat quasi) . transform
, quoteType = (quoteType quasi) . transform
, quoteDec = (quoteDec quasi) . transform
}
Now you can make a version of lt
that does what you need:
lt_ = transformQuasiQuoter stripWhiteSpaceBeforeBackslash lt
Using it works as expected:
programName = "SomeProgram"
showVersion _ = "42.42.42"
version = 34
x = [lt_|Usage: #{programName} [OPTIONS...]
\Version #{showVersion version}|]
x
evaluates to "Usage: SomeProgram [OPTIONS...]\nVersion 42.42.42"
in ghci.