yasi-0.2.0.0: Yet another string interpolator
Safe HaskellNone
LanguageHaskell2010

Yasi

Contents

Description

Yet another string interpolator

  • Very simple, few dependencies.
  • Based on Display instead of Show.
  • Depends on ghc-hs-meta instead of haskell-src-meta for interpolating arbitrary expressions. This result in faster compile times and fewer bugs.
Synopsis

Documentation

i :: QuasiQuoter Source #

The main interpolator, intended to be used with QuasiQuotes.

>>> :set -XQuasiQuotes
>>> (foo, bar) = ("yet another ", "interpolator")
>>> [i|${foo}string $bar|] :: String
"yet another string interpolator"

The result type can be String, strict Text or lazy Text.

You can also use ${} to create a function interpolator (this "abstraction" feature is inspired by interpolate):

>>> [i|more ${}${} code${replicate 3 '!'}|] "point" "free" :: Text
"more pointfree code!!!"

Variants

iFS :: QuasiQuoter Source #

Like i, but works with IsString.

[iFS|...|] = fromString [i|...|]
>>> :t [iFS|hi|]
[iFS|hi|] :: Data.String.IsString a => a

iS :: QuasiQuoter Source #

Like i, but with the result type fixed to String.

[iS|...|] = [i|...|] :: String
>>> :t [iS|hi|]
[iS|hi|] :: String

iT :: QuasiQuoter Source #

Like i, but with the result type fixed to strict Text.

[iT|...|] = [i|...|] :: Text
>>> :t [iT|hi|]
[iT|hi|] :: Text

iTL :: QuasiQuoter Source #

Like i, but with the result type fixed to lazy Text.

[iTL|...|] = [i|...|] :: Text
>>> :t [iTL|hi|]
[iTL|hi|] :: Data.Text.Lazy.Text