Portability | unknown |
---|---|
Stability | experimental |
Maintainer | me@jspha.com |
Safe Haskell | None |
The internal workings of inserts
. In most cases you don't want to be
digging around in this module, but it's useful if you want to somehow analyze
or transform the Template
type.
The usual caveat applies: this module is not a public API and is subject to modification without warning.
- newtype Template = Template {}
- data TemplateC
- = Literal Builder
- | Hole ByteString
- data Got a
- = Miss (DList ByteString)
- | Got a
- gotEither :: Got a -> Either [ByteString] a
- runTemplate :: (ByteString -> Maybe ByteString) -> Template -> Either [ByteString] ByteString
- showTemplate :: Template -> ByteString
- parseTemplate :: ByteString -> Either String Template
- templateParser :: Parser Template
Major types
The purely-Applicative Either
Got
is the "purely Applicative
" Either
with
[S.ByteString]
as its Left
type. When both the left and
right arguments to '(*)' are Miss
their errors are mappend
ed
together.
Miss (DList ByteString) | |
Got a |
gotEither :: Got a -> Either [ByteString] aSource
Template functions
runTemplate :: (ByteString -> Maybe ByteString) -> Template -> Either [ByteString] ByteStringSource
Outputs either the successfully interpolated template or the list of
missing keys. For fast operation, try building the lookup function using
unordered-containers
HashMap
s.
showTemplate :: Template -> ByteStringSource
We can build a lazy ByteString
much more quickly, so if you need
to quickly show your templates then this might be nicer than using show
directly.
parseTemplate :: ByteString -> Either String TemplateSource
Try to parse a ByteString
as a Template
.