-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell string/text/bytestring interpolation that just works -- -- Unicode-aware string interpolation that handles all textual types. -- -- See the README at -- https://gitlab.com/williamyaoh/string-interpolate/blob/master/README.md -- for more info. @package string-interpolate @version 0.3.3.0 module Data.String.Interpolate.Conversion.ByteStringSink instance Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.True Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.True Data.ByteString.Builder.Internal.Builder instance GHC.Show.Show src => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True src Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Types.Char Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Base.String Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Text Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Lazy.Text Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Builder.Builder Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Internal.Type.ByteString Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Internal.Type.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Builder.Internal.Builder Data.ByteString.Internal.Type.ByteString instance GHC.Show.Show src => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True src Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Types.Char Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Base.String Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Text Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Lazy.Text Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Builder.Builder Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Internal.Type.ByteString Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Lazy.Internal.ByteString instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Builder.Internal.Builder Data.ByteString.Lazy.Internal.ByteString instance GHC.Show.Show src => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True src Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Types.Char Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Base.String Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Text Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Lazy.Text Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Builder.Builder Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Internal.Type.ByteString Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Builder.Internal.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Builder.Internal.Builder Data.ByteString.Builder.Internal.Builder module Data.String.Interpolate.Conversion.TextSink instance Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.True Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.True Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.True Data.Text.Internal.Builder.Builder instance GHC.Show.Show src => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True src Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Types.Char Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Base.String Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Text Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Lazy.Text Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Builder.Builder Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Internal.Type.ByteString Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString Data.Text.Internal.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Builder.Internal.Builder Data.Text.Internal.Text instance GHC.Show.Show src => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True src Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Types.Char Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Base.String Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Text Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Lazy.Text Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Builder.Builder Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Internal.Type.ByteString Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString Data.Text.Internal.Lazy.Text instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Builder.Internal.Builder Data.Text.Internal.Lazy.Text instance GHC.Show.Show src => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True src Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Types.Char Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True GHC.Base.String Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Text Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Lazy.Text Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.Text.Internal.Builder.Builder Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Internal.Type.ByteString Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Lazy.Internal.ByteString Data.Text.Internal.Builder.Builder instance Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.True Data.ByteString.Builder.Internal.Builder Data.Text.Internal.Builder.Builder module Data.String.Interpolate.Conversion -- | Does this type require special behavior when something is interpolated -- into it? type family IsCustomSink dst -- | Something that can be interpolated into. class IsCustomSink dst ~ flag => InterpSink (flag :: Bool) dst where { type Builder flag dst :: Type; } -- | Meant to be used only for verbatim parts of the interpolation. ofString :: InterpSink flag dst => Proxy flag -> String -> B dst (Builder flag dst) -- | build should be 'in-order'; that is, the left builder comes -- from a string on the left, and the right builder comes from a string -- on the right. build :: InterpSink flag dst => Proxy flag -> B dst (Builder flag dst) -> B dst (Builder flag dst) -> B dst (Builder flag dst) finalize :: InterpSink flag dst => Proxy flag -> B dst (Builder flag dst) -> dst -- | Represents that we can interpolate objects of type src into a an -- interpolation string that returns type dst. class InterpSink flag dst => Interpolatable (flag :: Bool) src dst interpolate :: Interpolatable flag src dst => Proxy flag -> src -> B dst (Builder flag dst) -- | Convert a strict ByteString into a Text Builder, converting any -- invalid characters into the Unicode replacement character � (U+FFFD). bsToTextBuilder :: ByteString -> Builder -- | Convert a lazy ByteString into a Text Builder, converting any -- invalid characters into the Unicode replacement character � (U+FFFD). lbsToTextBuilder :: ByteString -> Builder -- | Data.ByteString.Builder provides charUtf8 to do this, -- but it doesn't correctly handle invalid characters. encodeCharUTF8 :: Char -> Builder instance (Data.String.Interpolate.Conversion.Classes.IsCustomSink str GHC.Types.~ 'GHC.Types.False, Data.String.IsString str) => Data.String.Interpolate.Conversion.Classes.InterpSink 'GHC.Types.False str instance (GHC.Show.Show src, Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False src dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False GHC.Types.Char dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False GHC.Base.String dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False Data.Text.Internal.Text dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False Data.Text.Internal.Lazy.Text dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False Data.Text.Internal.Builder.Builder dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False Data.ByteString.Internal.Type.ByteString dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False Data.ByteString.Lazy.Internal.ByteString dst instance (Data.String.IsString dst, Data.String.Interpolate.Conversion.Classes.IsCustomSink dst GHC.Types.~ 'GHC.Types.False) => Data.String.Interpolate.Conversion.Classes.Interpolatable 'GHC.Types.False Data.ByteString.Builder.Internal.Builder dst module Data.String.Interpolate.Types data InterpSegment Expression :: String -> InterpSegment Verbatim :: String -> InterpSegment Spaces :: Int -> InterpSegment Tabs :: Int -> InterpSegment type Line = [InterpSegment] type Lines = [Line] instance GHC.Show.Show Data.String.Interpolate.Types.InterpSegment instance GHC.Classes.Eq Data.String.Interpolate.Types.InterpSegment -- | YOU SHOULD NOT USE THIS MODULE. -- -- This is exported mainly so tests can introspect on the implementation. module Data.String.Interpolate.Parse -- | Each section here is a list of lines. -- -- Content here is defined by the contiguous sequence of lines -- begining with the first non-blank line and ending with the last -- non-blank line data ParseOutput ParseOutput :: Lines -> Lines -> Lines -> ParseOutput [poHeaderWS] :: ParseOutput -> Lines [poContent] :: ParseOutput -> Lines [poFooterWS] :: ParseOutput -> Lines -- | Like parseInterpSegments, but for cases where we need to do -- more complicated transformations on the input. Separates the -- interpolation input into its content, whitespace header, and -- whitespace footer. parseInput :: String -> Either String ParseOutput -- | Given the raw input from a quasiquote, parse it into the information -- we need to output the actual expression. -- -- Returns an error message if parsing fails. parseInterpSegments :: String -> Either String Lines dosToUnix :: String -> String instance GHC.Show.Show Data.String.Interpolate.Parse.ParseOutput instance GHC.Classes.Eq Data.String.Interpolate.Parse.ParseOutput -- | This module provides three quasiquoters, i, __i, and -- iii, which: -- --
-- {-# LANGUAGE OverloadedStrings #-}
-- {-# LANGUAGE QuasiQuotes #-}
--
-- import Data.Text
-- import Data.String.Interpolate ( i )
--
-- λ> age = 33 :: Int
-- λ> name = "Tatiana" :: Text
-- λ> [i|{"name": "#{name}", "age": #{age}}|] :: String
-- >>> "{\"name\": \"Tatiana\", \"age\": 33}"
--
-- λ> [i|
-- Name: #{name}
-- Age: #{age}
-- |] :: String
-- >>> "\nName: Tatiana\nAge: 33\n"
--
--
-- There are also variants of __i and iii which have
-- different behavior for surrounding newlines.
--
-- See the README at
-- https://gitlab.com/williamyaoh/string-interpolate/blob/master/README.md
-- for more details and examples.
module Data.String.Interpolate
-- | The basic, no-frills interpolator. Will interpolate anything you wrap
-- in #{}, and otherwise leaves what you write alone.
i :: QuasiQuoter
-- | An interpolator that handles indentation. Will interpolate anything
-- you wrap in #{}, remove leading indentation, and remove any
-- blank lines before and after the content.
--
-- If the contained interpolation uses both tabs and spaces for
-- indentation, __i will assume the indentation type it finds in
-- the first nonblank line, ignoring indentation of the other type.
-- Please don't use mixed indentation.
--
-- Note that only indentation you actually write in source code will be
-- stripped; __i does not touch any lines or whitespace inserted
-- by interpolations themselves.
--
-- There is no extra performance penalty for using __i.
__i :: QuasiQuoter
-- | An interpolator that strips excess whitespace. Will collapse any
-- sequences of multiple spaces or whitespace into a single space,
-- putting the output onto a single line with surrounding whitespace
-- removed.
--
-- Note that only whitespace you actually write in source code will be
-- collapsed; iii does not touch any lines or whitespace
-- inserted by interpolations themselves.
--
-- There is no extra performance penalty for using iii.
iii :: QuasiQuoter
-- | Like __i, but leaves any surrounding newlines intact.
--
-- The way to remember which is which is to look at the suffix character;
-- the multiple horizontal lines of the capital E suggests
-- multiple textual lines.
__i'E :: QuasiQuoter
-- | Like __i, but collapses any surrounding newlines into a single
-- newline.
--
-- The way to remember which is which is to look at the suffix character;
-- the single horizontal line of the capital L suggests that it
-- leaves only a single newline.
__i'L :: QuasiQuoter
-- | Like iii, but leaves any surrounding newlines intact.
--
-- The way to remember which is which is to look at the suffix character;
-- the multiple horizontal lines of the capital E suggests
-- multiple textual lines.
iii'E :: QuasiQuoter
-- | Like iii, but collapses any surrounding newlines into a single
-- newline.
--
-- The way to remember which is which is to look at the suffix character;
-- the single horizontal line of the capital L suggests that it
-- leaves only a single newline.
iii'L :: QuasiQuoter