Copyright | (c) Justus Adam 2016 |
---|---|

License | BSD3 |

Maintainer | dev@justus.science |

Stability | experimental |

Portability | POSIX |

Safe Haskell | None |

Language | Haskell2010 |

Please refer to the documentation at https://marvin.readthedocs.io/en/latest/interpolation.html for examples and explanations on how to use this library.

- is :: String -> Q Exp
- iq :: QuasiQuoter
- interpolateInto :: Exp -> String -> Exp

# Documentation

is :: String -> Q Exp Source #

**i**nterpolate **s**plice

Template Haskell splice function, used like `$(is "my str #{expr}")`

Performs no conversion on interpolated expressions like `expr`

.

iq :: QuasiQuoter Source #

**i**nterpolate **q**uoter

QuasiQuoter, used like `[iq|my str #{expr}|]`

Performs no conversion on interpolated expressions like `expr`

.

# Internals/extension points

interpolateInto :: Exp -> String -> Exp Source #

Common core of all interpolators.

`interpolateInto exp str`

parses `str`

as the interpolated string and returns an `Exp`

which looks like

"str" `mappend` exp1 `mappend` "str" `mappend` exp2 `mappend` "str"

where `exp1`

and `exp2`

are the interpolated expressions with `exp`

prepended.
The intended use of `exp`

is to unifomly convert the interpolated expressions into a desired string type.
Typically `exp`

will be something like `(`

were `VarE`

'convert)`convert`

is some member function of a conversion type class.