vulkan-utils-0.4: Utils for the vulkan package
Safe HaskellNone
LanguageHaskell2010

Vulkan.Utils.ShaderQQ.Interpolate

Synopsis

Documentation

interpExp :: String -> Q Exp Source #

interpExp performs very simple interpolation of Haskell values into Strings.

  • 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 \$
>>> let foo = 123 in $(interpExp "hello, $foo")
"hello, 123"
>>> let foo = "world" in $(interpExp "hello, \\$foo")
"hello, $foo"
>>> let foo = "world" in $(interpExp "hello\r\n\rworld")
"hello\r\n\rworld"