Safe Haskell | None |
---|---|
Language | Haskell98 |
- data SElem a
- class Show a => StringTemplateShows a where
- class ToSElem a where
- type SMap a = Map String (SElem a)
- data STShow = StringTemplateShows a => STShow a
- newtype StFirst a = StFirst {
- stGetFirst :: Maybe a
- class Monoid a => Stringable a where
- stShowsToSE :: (StringTemplateShows a, Stringable b) => a -> SElem b
Documentation
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.
stringTemplateShow :: a -> String Source #
Defaults to show
.
stringTemplateFormattedShow :: String -> a -> String Source #
Defaults to _ a -> stringTemplateShow a
class ToSElem a where Source #
The ToSElem class should be instantiated for all types that can be inserted as attributes into a StringTemplate.
toSElem :: Stringable b => a -> SElem b Source #
toSElemList :: Stringable b => [a] -> SElem b Source #
StringTemplateShows a => STShow a |
StFirst | |
|
class Monoid a => Stringable a where Source #
The Stringable class should be instantiated with care. Generally, the provided instances should be enough for anything.
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 "]"]
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.