Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- hlsl :: QuasiQuoter
- insertLineDirective :: String -> Loc -> String
Documentation
hlsl :: QuasiQuoter Source #
hlsl
is a QuasiQuoter which produces HLSL source code with a #line
directive inserted so that error locations point to the correct location in
the Haskell source file. It also permits basic string interpolation.
- Interpolated variables are prefixed with
$
- They can optionally be surrounded with braces like
${foo}
- Interpolated variables are converted to strings with
show
- To escape a
$
use\$
An explicit example (interactive
is from doctest):
>>>
let foo = 450 :: Int in [hlsl|const float foo = $foo|]
"#line 77 \"<interactive>\"\nconst float foo = 450"
Note that line number will be thrown off if any of the interpolated variables contain newlines.