string-interpolate-0.0.1.0: Haskell string interpolation that just works

Safe HaskellNone
LanguageHaskell2010

Data.String.Interpolate.Conversion

Synopsis

Documentation

newtype B dst a Source #

We wrap the builders in B so that we can add a phantom type parameter. This gives the inner interpolates enough information to know where they're going and pick an instance, forcing all the types into lockstep.

Constructors

B 

Fields

Instances
Eq a => Eq (B dst a) Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

(==) :: B dst a -> B dst a -> Bool #

(/=) :: B dst a -> B dst a -> Bool #

Show a => Show (B dst a) Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

showsPrec :: Int -> B dst a -> ShowS #

show :: B dst a -> String #

showList :: [B dst a] -> ShowS #

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 :: * 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
(IsCustomSink str ~ False, IsString str) => InterpSink False str Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Associated Types

type Builder False str :: Type 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

Associated Types

type Builder True ByteString :: Type Source #

InterpSink True ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Associated Types

type Builder True ByteString :: Type Source #

InterpSink True Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Associated Types

type Builder True Text :: Type Source #

InterpSink True Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Associated Types

type Builder True Text :: Type 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
(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 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 Text dst Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Methods

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

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

Defined in Data.String.Interpolate.Conversion

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

Defined in Data.String.Interpolate.Conversion

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

Defined in Data.String.Interpolate.Conversion

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

Defined in Data.String.Interpolate.Conversion

Interpolatable True String ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True String ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True String Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True String Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True ByteString Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text ByteString Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

Interpolatable True Text Text Source # 
Instance details

Defined in Data.String.Interpolate.Conversion

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).