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

Safe HaskellNone
LanguageHaskell2010

Text.EDE.Internal.Filters

Contents

Synopsis

Prelude

defaultFilters :: HashMap Text Binding

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

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

Fractional

Textual

  • takeWord :: Text -> Text
  • dropWord :: Text -> Text
  • lowerHead :: Text -> Text
  • upperHead :: Text -> Text
  • toTitle :: Text -> Text
  • toCamel :: Text -> Text
  • toPascal :: Text -> Text
  • toSnake :: Text -> Text
  • toSpinal :: Text -> Text
  • toTrain :: Text -> Text
  • toLower :: Text -> Text
  • toUpper :: Text -> Text
  • toOrdinal :: Number -> Text

See: text-manipulate

Collection

Polymorphic

Constructing filters

data Binding

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

Constructors

BVal !Value 
BLam (Binding -> Result Binding) 

Classes

class Quote a where

Methods

quote :: a -> Binding

Instances

Quote Bool 
Quote Double 
Quote Int 
Quote Integer 
Quote Value 
Quote Object 
Quote Array 
Quote Text 
Quote Text 
Quote Builder 
Quote Scientific 
Quote Binding 
(Unquote a, Quote b) => Quote (a -> b) 

class Unquote a where

Methods

unquote :: Binding -> Result a

Instances

Unquote Bool 
Unquote Value 
Unquote Object 
Unquote Array 
Unquote Text 
Unquote Text 
Unquote Scientific 

Restricted quoters

qapply :: Binding -> Binding -> Result Binding

Attempt to apply two Bindings.

qpoly2 :: Quote a => (Value -> Value -> a) -> Binding

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

qnum1 :: (Scientific -> Scientific) -> Binding

Quote an unary numeric function.

qnum2 :: Quote a => (Scientific -> Scientific -> a) -> Binding

Quote a binary numeric function.

qcol1 :: Quote a => (Text -> a) -> (Object -> a) -> (Array -> a) -> Binding

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

Errors

typeOf :: Value -> String

Retrieve a consistent type from a Value to use in error messages.