Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- glsl :: QuasiQuoter
- insertLineDirective :: String -> Loc -> String
Documentation
glsl :: QuasiQuoter Source #
glsl
is a QuasiQuoter which produces GLSL source code with #line
directives 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 version = 450 :: Int in [glsl|#version $version|]
"#version 450\n#extension GL_GOOGLE_cpp_style_line_directive : enable\n#line 72 \"<interactive>\"\n"
Note that line number will be thrown off if any of the interpolated variables contain newlines.