string-interpolate-0.3.1.0: Haskell string/text/bytestring interpolation that just works
Copyright(c) William Yao 2019-2020
LicenseBSD-3
Maintainerwilliamyaoh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.String.Interpolate.Conversion

Description

 
Synopsis

Documentation

type family IsCustomSink dst where ... Source #

Does this type require special behavior when something is interpolated into it?

class IsCustomSink dst ~ flag => InterpSink (flag :: Bool) dst where Source #

Something that can be interpolated into.

Associated Types

type Builder flag dst :: Type Source #

Methods

ofString :: Proxy flag -> String -> B dst (Builder flag dst) Source #

Meant to be used only for verbatim parts of the interpolation.

build :: Proxy flag -> B dst (Builder flag dst) -> B dst (Builder flag dst) -> B dst (Builder flag dst) Source #

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.

finalize :: Proxy flag -> B dst (Builder flag dst) -> dst Source #

Instances

Instances details
(IsCustomSink str ~ 'False, IsString str) => InterpSink 'False str Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Associated Types

type Builder 'False str Source #

Methods

ofString :: Proxy 'False -> String -> B str (Builder 'False str) Source #

build :: Proxy 'False -> B str (Builder 'False str) -> B str (Builder 'False str) -> B str (Builder 'False str) Source #

finalize :: Proxy 'False -> B str (Builder 'False str) -> str Source #

InterpSink 'True ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Associated Types

type Builder 'True ByteString Source #

InterpSink 'True ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Associated Types

type Builder 'True ByteString Source #

InterpSink 'True Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Associated Types

type Builder 'True Builder Source #

InterpSink 'True Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Associated Types

type Builder 'True Text Source #

InterpSink 'True Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Associated Types

type Builder 'True Builder Source #

InterpSink 'True Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Associated Types

type Builder 'True Text Source #

class InterpSink flag dst => Interpolatable (flag :: Bool) src dst where Source #

Represents that we can interpolate objects of type src into a an interpolation string that returns type dst.

Methods

interpolate :: Proxy flag -> src -> B dst (Builder flag dst) Source #

Instances

Instances details
(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Char dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> Char -> B dst (Builder 'False dst) Source #

(Show src, IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False src dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> src -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False String dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> String -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False ByteString dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> ByteString -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False ByteString dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> ByteString -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Builder dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> Builder -> B dst (Builder0 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Text dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> Text -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Builder dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> Builder -> B dst (Builder0 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Text dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

interpolate :: Proxy 'False -> Text -> B dst (Builder 'False dst) Source #

Interpolatable 'True Char ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Char ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Char Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Char Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Char Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Char Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Show src => Interpolatable 'True src Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Show src => Interpolatable 'True src ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Show src => Interpolatable 'True src ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Show src => Interpolatable 'True src Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Show src => Interpolatable 'True src Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Methods

interpolate :: Proxy 'True -> src -> B Text (Builder 'True Text) Source #

Show src => Interpolatable 'True src Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Methods

interpolate :: Proxy 'True -> src -> B Text (Builder 'True Text) Source #

Interpolatable 'True String ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True String ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True String Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True String Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True String Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True String Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True ByteString Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True ByteString Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True ByteString Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True ByteString Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Builder ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Builder ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Builder Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Builder Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Builder Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Builder Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Text Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Text Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Builder ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Builder ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Builder Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Builder Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Builder Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Builder Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Text Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.ByteStringSink

Interpolatable 'True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Text Builder Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

Interpolatable 'True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion.TextSink

bsToTextBuilder :: ByteString -> Builder Source #

Convert a strict ByteString into a Text Builder, converting any invalid characters into the Unicode replacement character � (U+FFFD).

lbsToTextBuilder :: ByteString -> Builder Source #

Convert a lazy ByteString into a Text Builder, converting any invalid characters into the Unicode replacement character � (U+FFFD).

encodeCharUTF8 :: Char -> Builder Source #

Data.ByteString.Builder provides charUtf8 to do this, but it doesn't correctly handle invalid characters.

Orphan instances

(IsCustomSink str ~ 'False, IsString str) => InterpSink 'False str Source # 
Instance details

Associated Types

type Builder 'False str Source #

Methods

ofString :: Proxy 'False -> String -> B str (Builder 'False str) Source #

build :: Proxy 'False -> B str (Builder 'False str) -> B str (Builder 'False str) -> B str (Builder 'False str) Source #

finalize :: Proxy 'False -> B str (Builder 'False str) -> str Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Char dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> Char -> B dst (Builder 'False dst) Source #

(Show src, IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False src dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> src -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False String dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> String -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False ByteString dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> ByteString -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False ByteString dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> ByteString -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Builder dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> Builder -> B dst (Builder0 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Text dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> Text -> B dst (Builder 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Builder dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> Builder -> B dst (Builder0 'False dst) Source #

(IsString dst, IsCustomSink dst ~ 'False) => Interpolatable 'False Text dst Source # 
Instance details

Methods

interpolate :: Proxy 'False -> Text -> B dst (Builder 'False dst) Source #