Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data InterpolationConfig a = InterpolationConfig {}
- simpleConfig :: InterpolationConfig ()
- defaultConfig :: InterpolationConfig a
- data Interpolator a = Interpolator {}
- type Prefix = String
- data Brackets = Brackets {}
- curlyBrackets :: Brackets
- roundBrackets :: Brackets
- squareBrackets :: Brackets
- angleBrackets :: Brackets
- simpleInterpolator :: Interpolator ()
- applyInterpolator :: Monoid a => Q Exp -> Interpolator a
Documentation
>>>
import CustomInterpolation -- doctest setup, ignore this
data InterpolationConfig a Source #
Rules for interpolating a string.
InterpolationConfig | |
|
Instances
Default (InterpolationConfig a) Source # |
|
Defined in CustomInterpolation.Config def :: InterpolationConfig a # |
simpleConfig :: InterpolationConfig () Source #
Type-restricted simple version of defaultConfig
.
Use this if you just want to substitute interpolated segments with a string expression.
defaultConfig :: InterpolationConfig a Source #
Default InterpolationConfig
.
Has no handlers
, finalize
ignores any extra values returned when interpolating and escape
does nothing.
data Interpolator a Source #
Interpolator | |
|
curlyBrackets :: Brackets Source #
{}
roundBrackets :: Brackets Source #
()
squareBrackets :: Brackets Source #
[]
angleBrackets :: Brackets Source #
<>
simpleInterpolator :: Interpolator () Source #
Default Interpolator
.
Inserts the interpolated expression as is and uses curlyBrackets
with no prefix
.
applyInterpolator :: Monoid a => Q Exp -> Interpolator a Source #
Create an Interpolator
that applies a quoted function to the interpolated expression. Uses curlyBrackets
and no prefix
.
Example
>>>
$(interpolate (simpleConfig {handlers = [applyInterpolator [|show . (^ 2)|]]}) "two squared equals {2}")
"two squared equals 4"