-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Efficient interpolation for Prettyprinter -- -- This package provides efficient interpolation of -- string-interpolate quasi quoters when used with -- prettyprinter. @package prettyprinter-interp @version 0.2.0.0 -- |
-- {-# LANGUAGE OverloadedStrings #-}
-- {-# LANGUAGE QuasiQuotes #-}
--
-- module Main where
--
-- import Data.String.Interpolate
-- import Data.Text (Text)
-- import Prettyprinter
--
-- f :: Text
-- f = "world"
--
-- g :: Doc ()
-- g = [i|Hello #{f}!|]
--
-- main :: IO ()
-- main = print g
--
--
--
-- However, what happens under the hood is that f is converted
-- to String, the interpolated string is built manipulating
-- Strings, and then the output is converted to Text in
-- prettyprinter. The following code is much better:
--
--
-- g = pretty ([i|Hello #{f}!|] :: Text)
--
--
--
-- Now, the interpolated string is constructed as Text, and this
-- is passed cleanly into Doc which also uses Text as
-- its underlying type for representation of text. At no point is
-- f converted to String, and the string construction
-- benefits from the performance of Text. And again, newlines
-- are converted to line.
--
-- This module defines wrapper quasi quoters that automatically perform
-- the pretty invocation, and can simply be used as:
--
--
-- g = [di|Hello #{f}!|]
--
--
module Prettyprinter.Interpolate
-- | Wrapper around the i quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
di :: QuasiQuoter
-- | Wrapper around the __i quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
__di :: QuasiQuoter
-- | Wrapper around the iii quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
diii :: QuasiQuoter
-- | Wrapper around the __i'E quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
__di'E :: QuasiQuoter
-- | Wrapper around the __i'L quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
__di'L :: QuasiQuoter
-- | Wrapper around the iii'E quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
diii'E :: QuasiQuoter
-- | Wrapper around the iii'L quasi quoter, producing a Doc
--
-- Newlines in the text are converted to line.
diii'L :: QuasiQuoter
-- | Deprecated: d__i'E is a deprecated alias for __di'E
-- and will be removed in prettyprinter-interp 0.3
d__i'E :: QuasiQuoter
-- | Deprecated: d__i'L is a deprecated alias for __di'L
-- and will be removed in prettyprinter-interp 0.3
d__i'L :: QuasiQuoter