HStringTemplate-0.8.7: StringTemplate implementation in Haskell.

Safe HaskellNone
LanguageHaskell98

Text.StringTemplate.Classes

Synopsis

Documentation

data SElem a Source #

Constructors

STR String 
BS ByteString 
TXT Text 
STSH STShow 
SM (SMap a) 
LI [SElem a] 
SBLE a 
SNAT a 
SNull 

class Show a => StringTemplateShows a where Source #

The StringTemplateShows class should be instantiated for all types that are directly displayed in a StringTemplate, but take an optional format string. Each such type must have an appropriate ToSElem method defined as well.

Minimal complete definition

Nothing

Methods

stringTemplateShow :: a -> String Source #

Defaults to show.

stringTemplateFormattedShow :: String -> a -> String Source #

Defaults to _ a -> stringTemplateShow a

Instances
StringTemplateShows Double Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: Double -> String Source #

stringTemplateFormattedShow :: String -> Double -> String Source #

StringTemplateShows Float Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: Float -> String Source #

stringTemplateFormattedShow :: String -> Float -> String Source #

StringTemplateShows Day Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: Day -> String Source #

stringTemplateFormattedShow :: String -> Day -> String Source #

StringTemplateShows UTCTime Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: UTCTime -> String Source #

stringTemplateFormattedShow :: String -> UTCTime -> String Source #

StringTemplateShows LocalTime Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: LocalTime -> String Source #

stringTemplateFormattedShow :: String -> LocalTime -> String Source #

StringTemplateShows TimeOfDay Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: TimeOfDay -> String Source #

stringTemplateFormattedShow :: String -> TimeOfDay -> String Source #

StringTemplateShows TimeZone Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: TimeZone -> String Source #

stringTemplateFormattedShow :: String -> TimeZone -> String Source #

StringTemplateShows ZonedTime Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

stringTemplateShow :: ZonedTime -> String Source #

stringTemplateFormattedShow :: String -> ZonedTime -> String Source #

class ToSElem a where Source #

The ToSElem class should be instantiated for all types that can be inserted as attributes into a StringTemplate.

Minimal complete definition

toSElem

Methods

toSElem :: Stringable b => a -> SElem b Source #

toSElemList :: Stringable b => [a] -> SElem b Source #

Instances
ToSElem Bool Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Bool -> SElem b Source #

toSElemList :: Stringable b => [Bool] -> SElem b Source #

ToSElem Char Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Char -> SElem b Source #

toSElemList :: Stringable b => [Char] -> SElem b Source #

ToSElem Double Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Double -> SElem b Source #

toSElemList :: Stringable b => [Double] -> SElem b Source #

ToSElem Float Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Float -> SElem b Source #

toSElemList :: Stringable b => [Float] -> SElem b Source #

ToSElem Int Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Int -> SElem b Source #

toSElemList :: Stringable b => [Int] -> SElem b Source #

ToSElem Integer Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Integer -> SElem b Source #

toSElemList :: Stringable b => [Integer] -> SElem b Source #

ToSElem () Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => () -> SElem b Source #

toSElemList :: Stringable b => [()] -> SElem b Source #

Data a => ToSElem a Source # 
Instance details

Defined in Text.StringTemplate.GenericStandard

Methods

toSElem :: Stringable b => a -> SElem b Source #

toSElemList :: Stringable b => [a] -> SElem b Source #

ToSElem ByteString Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => ByteString -> SElem b Source #

toSElemList :: Stringable b => [ByteString] -> SElem b Source #

ToSElem ByteString Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => ByteString -> SElem b Source #

toSElemList :: Stringable b => [ByteString] -> SElem b Source #

ToSElem Text Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Text -> SElem b Source #

toSElemList :: Stringable b => [Text] -> SElem b Source #

ToSElem Text Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Text -> SElem b Source #

toSElemList :: Stringable b => [Text] -> SElem b Source #

ToSElem Day Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Day -> SElem b Source #

toSElemList :: Stringable b => [Day] -> SElem b Source #

ToSElem UTCTime Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => UTCTime -> SElem b Source #

toSElemList :: Stringable b => [UTCTime] -> SElem b Source #

ToSElem LocalTime Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => LocalTime -> SElem b Source #

toSElemList :: Stringable b => [LocalTime] -> SElem b Source #

ToSElem TimeOfDay Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => TimeOfDay -> SElem b Source #

toSElemList :: Stringable b => [TimeOfDay] -> SElem b Source #

ToSElem TimeZone Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => TimeZone -> SElem b Source #

toSElemList :: Stringable b => [TimeZone] -> SElem b Source #

ToSElem ZonedTime Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => ZonedTime -> SElem b Source #

toSElemList :: Stringable b => [ZonedTime] -> SElem b Source #

ToSElem Void Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Void -> SElem b Source #

toSElemList :: Stringable b => [Void] -> SElem b Source #

ToSElem a => ToSElem [a] Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => [a] -> SElem b Source #

toSElemList :: Stringable b => [[a]] -> SElem b Source #

ToSElem a => ToSElem (Maybe a) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Maybe a -> SElem b Source #

toSElemList :: Stringable b => [Maybe a] -> SElem b Source #

(Integral a, Show a) => ToSElem (Ratio a) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Ratio a -> SElem b Source #

toSElemList :: Stringable b => [Ratio a] -> SElem b Source #

(ToSElem a, Foldable t) => ToSElem (t a) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => t a -> SElem b Source #

toSElemList :: Stringable b => [t a] -> SElem b Source #

(ToSElem a, ToSElem b) => ToSElem (a, b) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b)] -> SElem b0 Source #

ToSElem a => ToSElem (Map String a) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Map String a -> SElem b Source #

toSElemList :: Stringable b => [Map String a] -> SElem b Source #

(ToSElem a, Ix i) => ToSElem (Array i a) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b => Array i a -> SElem b Source #

toSElemList :: Stringable b => [Array i a] -> SElem b Source #

(ToSElem a, ToSElem b, ToSElem c) => ToSElem (a, b, c) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d) => ToSElem (a, b, c, d) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e) => ToSElem (a, b, c, d, e) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d, e) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d, e)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f) => ToSElem (a, b, c, d, e, f) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d, e, f) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d, e, f)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g) => ToSElem (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d, e, f, g) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d, e, f, g)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g, ToSElem h) => ToSElem (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d, e, f, g, h) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d, e, f, g, h)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g, ToSElem h, ToSElem i) => ToSElem (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d, e, f, g, h, i) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d, e, f, g, h, i)] -> SElem b0 Source #

(ToSElem a, ToSElem b, ToSElem c, ToSElem d, ToSElem e, ToSElem f, ToSElem g, ToSElem h, ToSElem i, ToSElem j) => ToSElem (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

Defined in Text.StringTemplate.Instances

Methods

toSElem :: Stringable b0 => (a, b, c, d, e, f, g, h, i, j) -> SElem b0 Source #

toSElemList :: Stringable b0 => [(a, b, c, d, e, f, g, h, i, j)] -> SElem b0 Source #

type SMap a = Map String (SElem a) Source #

data STShow Source #

Constructors

StringTemplateShows a => STShow a 

newtype StFirst a Source #

Constructors

StFirst 

Fields

Instances
Functor StFirst Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

fmap :: (a -> b) -> StFirst a -> StFirst b

(<$) :: a -> StFirst b -> StFirst a

Eq a => Eq (StFirst a) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

(==) :: StFirst a -> StFirst a -> Bool

(/=) :: StFirst a -> StFirst a -> Bool

Ord a => Ord (StFirst a) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

compare :: StFirst a -> StFirst a -> Ordering

(<) :: StFirst a -> StFirst a -> Bool

(<=) :: StFirst a -> StFirst a -> Bool

(>) :: StFirst a -> StFirst a -> Bool

(>=) :: StFirst a -> StFirst a -> Bool

max :: StFirst a -> StFirst a -> StFirst a

min :: StFirst a -> StFirst a -> StFirst a

Read a => Read (StFirst a) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

readsPrec :: Int -> ReadS (StFirst a)

readList :: ReadS [StFirst a]

readPrec :: ReadPrec (StFirst a)

readListPrec :: ReadPrec [StFirst a]

Show a => Show (StFirst a) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

showsPrec :: Int -> StFirst a -> ShowS

show :: StFirst a -> String

showList :: [StFirst a] -> ShowS

Semigroup (StFirst a) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

(<>) :: StFirst a -> StFirst a -> StFirst a

sconcat :: NonEmpty (StFirst a) -> StFirst a

stimes :: Integral b => b -> StFirst a -> StFirst a

Monoid (StFirst a) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

mempty :: StFirst a

mappend :: StFirst a -> StFirst a -> StFirst a

mconcat :: [StFirst a] -> StFirst a

class Monoid a => Stringable a where Source #

The Stringable class should be instantiated with care. Generally, the provided instances should be enough for anything.

Minimal complete definition

stFromString, stToString

Methods

stFromString :: String -> a Source #

stFromByteString :: ByteString -> a Source #

stFromText :: Text -> a Source #

stToString :: a -> String Source #

mconcatMap :: [b] -> (b -> a) -> a Source #

Defaults to mconcatMap m k = foldr (mappend . k) mempty m

mintercalate :: a -> [a] -> a Source #

Defaults to (mconcat .) . intersperse

mlabel :: a -> a -> a Source #

Defaults to mlabel x y = mconcat [x, stFromString "[", y, stFromString "]"]

Instances
Stringable String Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> String Source #

stFromByteString :: ByteString -> String Source #

stFromText :: Text -> String Source #

stToString :: String -> String Source #

mconcatMap :: [b] -> (b -> String) -> String Source #

mintercalate :: String -> [String] -> String Source #

mlabel :: String -> String -> String Source #

Stringable Builder Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> Builder Source #

stFromByteString :: ByteString -> Builder Source #

stFromText :: Text -> Builder Source #

stToString :: Builder -> String Source #

mconcatMap :: [b] -> (b -> Builder) -> Builder Source #

mintercalate :: Builder -> [Builder] -> Builder Source #

mlabel :: Builder -> Builder -> Builder Source #

Stringable ByteString Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> ByteString Source #

stFromByteString :: ByteString -> ByteString Source #

stFromText :: Text -> ByteString Source #

stToString :: ByteString -> String Source #

mconcatMap :: [b] -> (b -> ByteString) -> ByteString Source #

mintercalate :: ByteString -> [ByteString] -> ByteString Source #

mlabel :: ByteString -> ByteString -> ByteString Source #

Stringable ByteString Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> ByteString Source #

stFromByteString :: ByteString0 -> ByteString Source #

stFromText :: Text -> ByteString Source #

stToString :: ByteString -> String Source #

mconcatMap :: [b] -> (b -> ByteString) -> ByteString Source #

mintercalate :: ByteString -> [ByteString] -> ByteString Source #

mlabel :: ByteString -> ByteString -> ByteString Source #

Stringable Text Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> Text Source #

stFromByteString :: ByteString -> Text Source #

stFromText :: Text -> Text Source #

stToString :: Text -> String Source #

mconcatMap :: [b] -> (b -> Text) -> Text Source #

mintercalate :: Text -> [Text] -> Text Source #

mlabel :: Text -> Text -> Text Source #

Stringable Text Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> Text Source #

stFromByteString :: ByteString -> Text Source #

stFromText :: Text0 -> Text Source #

stToString :: Text -> String Source #

mconcatMap :: [b] -> (b -> Text) -> Text Source #

mintercalate :: Text -> [Text] -> Text Source #

mlabel :: Text -> Text -> Text Source #

Stringable Builder Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> Builder Source #

stFromByteString :: ByteString -> Builder Source #

stFromText :: Text -> Builder Source #

stToString :: Builder -> String Source #

mconcatMap :: [b] -> (b -> Builder) -> Builder Source #

mintercalate :: Builder -> [Builder] -> Builder Source #

mlabel :: Builder -> Builder -> Builder Source #

Stringable Doc Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> Doc Source #

stFromByteString :: ByteString -> Doc Source #

stFromText :: Text -> Doc Source #

stToString :: Doc -> String Source #

mconcatMap :: [b] -> (b -> Doc) -> Doc Source #

mintercalate :: Doc -> [Doc] -> Doc Source #

mlabel :: Doc -> Doc -> Doc Source #

Stringable (Endo String) Source # 
Instance details

Defined in Text.StringTemplate.Classes

Methods

stFromString :: String -> Endo String Source #

stFromByteString :: ByteString -> Endo String Source #

stFromText :: Text -> Endo String Source #

stToString :: Endo String -> String Source #

mconcatMap :: [b] -> (b -> Endo String) -> Endo String Source #

mintercalate :: Endo String -> [Endo String] -> Endo String Source #

mlabel :: Endo String -> Endo String -> Endo String Source #

stShowsToSE :: (StringTemplateShows a, Stringable b) => a -> SElem b Source #

This method should be used to create ToSElem instances for types defining a custom formatted show function.