Copyright | (c) 2013-2022 Brendan Hay <brendan.g.hay@gmail.com> |
---|---|
License | This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. A copy of the MPL can be found in the LICENSE file or you can obtain it at http://mozilla.org/MPL/2.0/. |
Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The means to construct your own filters.
Synopsis
- data Term
- class Quote a where
- class Unquote a where
- (@:) :: Quote a => Id -> a -> (Id, Term)
- qapply :: Delta -> Term -> Term -> Result Term
- qpoly2 :: Quote a => Id -> (Value -> Value -> a) -> (Id, Term)
- qnum1 :: Id -> (Scientific -> Scientific) -> (Id, Term)
- qnum2 :: Quote a => Id -> (Scientific -> Scientific -> a) -> (Id, Term)
- qcol1 :: (Quote a, Quote b, Quote c) => Id -> (Text -> a) -> (HashMap Text Value -> b) -> (Vector Value -> c) -> (Id, Term)
- typeErr :: Id -> Int -> AnsiDoc -> AnsiDoc -> Result a
- argumentErr :: Pretty a => Id -> Int -> a -> Result b
Prelude
The default filters available to a template are documented by the subsequent categories.
These filters cannot be overriden and attempting to supply your own filters to
renderWith
will cause the similarly named filters to disappear when
they are merged with the prelude during evaluation. (See: union
)
Boolean
Equality
Relational
Numeric
Fractional
Textual
dropLower :: Text -> Text
- Drop preceding lowercase characters.
dropUpper
:: Text -> Text- Drop preceding uppercase characters.
indentLines
:: Text -> TextprependLines
:: Text -> TextjustifyLeft
:: Text -> Text- Using whitespace as fill character.
justifyRight
:: Text -> Text- Using whitespace as fill character.
center
:: Text -> Text- Using whitespace as fill character.
replace
:: Text -> Textremove
:: Text -> Text
- Shortcut for:
replace(pattern, "")
splitWords
:: Text -> Textstrip
:: Text -> TextstripPrefix
:: Text -> TextstripSuffix
:: Text -> TextstripStart
:: Text -> TextstripEnd
:: Text -> TexttakeWord
:: Text -> TextdropWord
:: Text -> TextlowerHead
:: Text -> TextupperHead
:: Text -> TexttoCamel
:: Text -> TexttoEllipsis
:: Text -> TexttoEllipsisWith
:: Text -> TexttoPascal
:: Text -> TexttoSnake
:: Text -> TexttoSpinal
:: Text -> TexttoTitle
:: Text -> TexttoTrain
:: Text -> TexttoLower
:: Text -> TexttoUpper
:: Text -> TexttoOrdinal
:: Scientific -> Text
Collection
length :: Collection -> Scientific
- See: Text.
length
, Vector.length
, HashMap.size
empty :: Collection -> Bool
- See: Text.
null
, Vector.null
, HashMap.null
reverse :: Collection -> Scientific
- See: Text.
reverse
, Vector.reverse
head :: Collection -> Scientific
- See: Text.
head
, Vector.head
last :: Collection -> Scientific
- See: Text.
last
, Vector.last
tail :: Collection -> Scientific
- See: Text.
tail
, Vector.tail
init
:: Collection -> Scientific
- See: Text.
init
, Vector.init
keys
:: Collection -> Scientificelems
:: Collection -> Scientific
Polymorphic
show
:: a -> Text
Constructing filters
A HOAS representation of (possibly partially applied) values in the environment.
Classes
Nothing
Instances
Quote Value Source # | |
Quote Term Source # | |
Quote Scientific Source # | |
Defined in Text.EDE.Internal.Quoting | |
Quote Text Source # | |
Quote Builder Source # | |
Quote Text Source # | |
Quote Integer Source # | |
Quote Bool Source # | |
Quote Double Source # | |
Quote Int Source # | |
Quote (KeyMap Value) Source # | |
Quote (Vector Value) Source # | |
Quote [Value] Source # | |
Quote [Text] Source # | |
Quote (HashMap Text Value) Source # | |
(Unquote a, Quote b) => Quote (a -> b) Source # | |
class Unquote a where Source #
Nothing
Instances
Unquote Value Source # | |
Unquote Collection Source # | |
Defined in Text.EDE.Internal.Quoting | |
Unquote Scientific Source # | |
Defined in Text.EDE.Internal.Quoting | |
Unquote Text Source # | |
Unquote Text Source # | |
Unquote Integer Source # | |
Unquote Bool Source # | |
Unquote Double Source # | |
Unquote Int Source # | |
Unquote (KeyMap Value) Source # | |
Unquote (Vector Value) Source # | |
Unquote [Text] Source # | |
Unquote (HashMap Text Value) Source # | |
Restricted quoters
qpoly2 :: Quote a => Id -> (Value -> Value -> a) -> (Id, Term) Source #
Quote a binary function which takes the most general binding value.
qnum1 :: Id -> (Scientific -> Scientific) -> (Id, Term) Source #
Quote an unary numeric function.
qnum2 :: Quote a => Id -> (Scientific -> Scientific -> a) -> (Id, Term) Source #
Quote a binary numeric function.
qcol1 :: (Quote a, Quote b, Quote c) => Id -> (Text -> a) -> (HashMap Text Value -> b) -> (Vector Value -> c) -> (Id, Term) Source #
Quote a comprehensive set of unary functions to create a binding that supports all collection types.