marvin-interpolate-1.1.1: Compile time string interpolation a la Scala and CoffeeScript

Copyright(c) Justus Adam 2016
LicenseBSD3
Maintainerdev@justus.science
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Marvin.Interpolate

Contents

Description

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

Synopsis

Documentation

is :: String -> Q Exp Source #

interpolate splice

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

Performs no conversion on interpolated expressions like expr.

iq :: QuasiQuoter Source #

interpolate quoter

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 (VarE 'convert) were convert is some member function of a conversion type class.