ede-0.2.8.7: Templating language with similar syntax and features to Liquid or Jinja2.

Safe HaskellNone
LanguageHaskell2010

Text.EDE.Filters

Contents

Description

The means to construct your own filters.

Synopsis

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

  • ! :: Bool -> Bool (See: not)
  • && :: Bool -> Bool -> Bool
  • || :: Bool -> Bool -> Bool

Equality

  • == :: a -> a -> Bool
  • != :: a -> a -> Bool (See: /=)

Relational

  • > :: a -> a -> Bool
  • >= :: a -> a -> Bool
  • <= :: a -> a -> Bool
  • <= :: a -> a -> Bool

Numeric

  • + :: Scientific -> Scientific -> Scientific
  • - :: Scientific -> Scientific -> Scientific
  • * :: Scientific -> Scientific -> Scientific
  • abs :: Scientific -> Scientific
  • signum :: Scientific -> Scientific
  • negate :: Scientific -> Scientific

Fractional

  • truncate :: Scientific -> Scientific
  • round :: Scientific -> Scientific
  • ceiling :: Scientific -> Scientific
  • floor :: Scientific -> Scientific

Textual

Collection

  • length :: Collection -> Scientific (See: Text.length, Vector.length, HashMap.size)
  • empty :: Collection -> Bool (See: Text:null, Vector.null, HashMap.null)

Polymorphic

Constructing filters

data Term #

A HOAS representation of (possibly partially applied) values in the environment.

Constructors

TVal !Value 
TLam (Term -> Result Term) 

Instances

Pretty Term # 

Methods

pretty :: Term -> Doc #

prettyList :: [Term] -> Doc #

Quote Term # 

Methods

quote :: Id -> Int -> Term -> Term #

Classes

class Quote a where #

Methods

quote :: Id -> Int -> a -> Term #

quote :: ToJSON a => Id -> Int -> a -> Term #

Instances

Quote Bool # 

Methods

quote :: Id -> Int -> Bool -> Term #

Quote Double # 

Methods

quote :: Id -> Int -> Double -> Term #

Quote Int # 

Methods

quote :: Id -> Int -> Int -> Term #

Quote Integer # 

Methods

quote :: Id -> Int -> Integer -> Term #

Quote Builder # 

Methods

quote :: Id -> Int -> Builder -> Term #

Quote Scientific # 

Methods

quote :: Id -> Int -> Scientific -> Term #

Quote Text # 

Methods

quote :: Id -> Int -> Text -> Term #

Quote Object # 

Methods

quote :: Id -> Int -> Object -> Term #

Quote Array # 

Methods

quote :: Id -> Int -> Array -> Term #

Quote Value # 

Methods

quote :: Id -> Int -> Value -> Term #

Quote Text # 

Methods

quote :: Id -> Int -> Text -> Term #

Quote Term # 

Methods

quote :: Id -> Int -> Term -> Term #

Quote [Text] # 

Methods

quote :: Id -> Int -> [Text] -> Term #

Quote [Value] # 

Methods

quote :: Id -> Int -> [Value] -> Term #

(Unquote a, Quote b) => Quote (a -> b) # 

Methods

quote :: Id -> Int -> (a -> b) -> Term #

class Unquote a where #

Methods

unquote :: Id -> Int -> Term -> Result a #

unquote :: FromJSON a => Id -> Int -> Term -> Result a #

Instances

Unquote Bool # 

Methods

unquote :: Id -> Int -> Term -> Result Bool #

Unquote Double # 

Methods

unquote :: Id -> Int -> Term -> Result Double #

Unquote Int # 

Methods

unquote :: Id -> Int -> Term -> Result Int #

Unquote Integer # 

Methods

unquote :: Id -> Int -> Term -> Result Integer #

Unquote Scientific # 

Methods

unquote :: Id -> Int -> Term -> Result Scientific #

Unquote Text # 

Methods

unquote :: Id -> Int -> Term -> Result Text #

Unquote Object # 

Methods

unquote :: Id -> Int -> Term -> Result Object #

Unquote Array # 

Methods

unquote :: Id -> Int -> Term -> Result Array #

Unquote Value # 

Methods

unquote :: Id -> Int -> Term -> Result Value #

Unquote Text # 

Methods

unquote :: Id -> Int -> Term -> Result Text #

Unquote [Text] # 

Methods

unquote :: Id -> Int -> Term -> Result [Text] #

Restricted quoters

(@:) :: Quote a => Id -> a -> (Id, Term) #

qapply :: Delta -> Term -> Term -> Result Term #

Fully apply two Terms.

qpoly2 :: Quote a => Id -> (Value -> Value -> a) -> (Id, Term) #

Quote a binary function which takes the most general binding value.

qnum1 :: Id -> (Scientific -> Scientific) -> (Id, Term) #

Quote an unary numeric function.

qnum2 :: Quote a => Id -> (Scientific -> Scientific -> a) -> (Id, Term) #

Quote a binary numeric function.

qcol1 :: (Quote a, Quote b, Quote c) => Id -> (Text -> a) -> (Object -> b) -> (Array -> c) -> (Id, Term) #

Quote a comprehensive set of unary functions to create a binding that supports all collection types.

Errors

typeErr :: Id -> Int -> Doc -> Doc -> Result a #

argumentErr :: Pretty a => Id -> Int -> a -> Result b #