ede-0.3.2.0: Templating language with similar syntax and features to Liquid or Jinja2.
Copyright(c) 2013-2020 Brendan Hay <brendan.g.hay@gmail.com>
LicenseThis 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/.
MaintainerBrendan Hay <brendan.g.hay@gmail.com>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Text.EDE.Internal.Types

Description

Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!

Synopsis

Documentation

class AnsiPretty a where Source #

Methods

apretty :: a -> AnsiDoc Source #

Instances

Instances details
AnsiPretty Var Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

apretty :: Var -> AnsiDoc Source #

AnsiPretty Term Source # 
Instance details

Defined in Text.EDE.Internal.Quoting

Methods

apretty :: Term -> AnsiDoc Source #

Show a => AnsiPretty (Result a) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

apretty :: Result a -> AnsiDoc Source #

AnsiPretty (PP Text) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

apretty :: PP Text -> AnsiDoc Source #

AnsiPretty (PP Value) Source # 
Instance details

Defined in Text.EDE.Internal.Types

newtype PP a Source #

Convenience wrapper for Pretty instances.

Constructors

PP 

Fields

Instances

Instances details
AnsiPretty (PP Text) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

apretty :: PP Text -> AnsiDoc Source #

AnsiPretty (PP Value) Source # 
Instance details

Defined in Text.EDE.Internal.Types

pp :: AnsiPretty (PP a) => a -> AnsiDoc Source #

(</>) :: Doc ann -> Doc ann -> Doc ann Source #

data Result a Source #

The result of running parsing or rendering steps.

Constructors

Success a 
Failure AnsiDoc 

Instances

Instances details
Monad Result Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

(>>=) :: Result a -> (a -> Result b) -> Result b #

(>>) :: Result a -> Result b -> Result b #

return :: a -> Result a #

Functor Result Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

fmap :: (a -> b) -> Result a -> Result b #

(<$) :: a -> Result b -> Result a #

Applicative Result Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

pure :: a -> Result a #

(<*>) :: Result (a -> b) -> Result a -> Result b #

liftA2 :: (a -> b -> c) -> Result a -> Result b -> Result c #

(*>) :: Result a -> Result b -> Result b #

(<*) :: Result a -> Result b -> Result a #

Foldable Result Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

fold :: Monoid m => Result m -> m #

foldMap :: Monoid m => (a -> m) -> Result a -> m #

foldMap' :: Monoid m => (a -> m) -> Result a -> m #

foldr :: (a -> b -> b) -> b -> Result a -> b #

foldr' :: (a -> b -> b) -> b -> Result a -> b #

foldl :: (b -> a -> b) -> b -> Result a -> b #

foldl' :: (b -> a -> b) -> b -> Result a -> b #

foldr1 :: (a -> a -> a) -> Result a -> a #

foldl1 :: (a -> a -> a) -> Result a -> a #

toList :: Result a -> [a] #

null :: Result a -> Bool #

length :: Result a -> Int #

elem :: Eq a => a -> Result a -> Bool #

maximum :: Ord a => Result a -> a #

minimum :: Ord a => Result a -> a #

sum :: Num a => Result a -> a #

product :: Num a => Result a -> a #

Traversable Result Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

traverse :: Applicative f => (a -> f b) -> Result a -> f (Result b) #

sequenceA :: Applicative f => Result (f a) -> f (Result a) #

mapM :: Monad m => (a -> m b) -> Result a -> m (Result b) #

sequence :: Monad m => Result (m a) -> m (Result a) #

Alternative Result Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

empty :: Result a #

(<|>) :: Result a -> Result a -> Result a #

some :: Result a -> Result [a] #

many :: Result a -> Result [a] #

Show a => Show (Result a) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

showsPrec :: Int -> Result a -> ShowS #

show :: Result a -> String #

showList :: [Result a] -> ShowS #

Show a => AnsiPretty (Result a) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

apretty :: Result a -> AnsiDoc Source #

_Success :: forall a a. Prism (Result a) (Result a) a a Source #

eitherResult :: Result a -> Either String a Source #

Convert a Result to an Either with the Left case holding a formatted error message, and Right being the successful result over which Result is paramterised.

result Source #

Arguments

:: (AnsiDoc -> b)

Function to apply to the Failure case.

-> (a -> b)

Function to apply to the Success case.

-> Result a

The Result to map over.

-> b 

Perform a case analysis on a Result.

success :: Monad m => a -> m (Result a) Source #

Convenience for returning a successful Result.

failure :: Monad m => AnsiDoc -> m (Result a) Source #

Convenience for returning an error Result.

type Resolver m = Syntax -> Id -> Delta -> m (Result Template) Source #

A function to resolve the target of an include expression.

data Template Source #

A parsed and compiled template.

Constructors

Template 

Instances

Instances details
Eq Template Source # 
Instance details

Defined in Text.EDE.Internal.Types

type Id = Text Source #

newtype Var Source #

Constructors

Var (NonEmpty Id) 

Instances

Instances details
Eq Var Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

(==) :: Var -> Var -> Bool #

(/=) :: Var -> Var -> Bool #

Show Var Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

showsPrec :: Int -> Var -> ShowS #

show :: Var -> String #

showList :: [Var] -> ShowS #

AnsiPretty Var Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

apretty :: Var -> AnsiDoc Source #

data Collection where Source #

Constructors

Col :: Foldable f => Int -> f (Maybe Text, Value) -> Collection 

Instances

Instances details
Unquote Collection Source # 
Instance details

Defined in Text.EDE.Internal.Quoting

Methods

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

data Pat Source #

Constructors

PWild 
PVar !Var 
PLit !Value 

Instances

Instances details
Eq Pat Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

(==) :: Pat -> Pat -> Bool #

(/=) :: Pat -> Pat -> Bool #

Show Pat Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

showsPrec :: Int -> Pat -> ShowS #

show :: Pat -> String #

showList :: [Pat] -> ShowS #

type Alt a = (Pat, a) Source #

data ExpF a Source #

Constructors

ELit !Value 
EVar !Var 
EFun !Id 
EApp !a !a 
ELet !Id !a !a 
ECase !a [Alt a] 
ELoop !Id !a !a 
EIncl !Text 

Instances

Instances details
Functor ExpF Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

fmap :: (a -> b) -> ExpF a -> ExpF b #

(<$) :: a -> ExpF b -> ExpF a #

Eq1 ExpF Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

liftEq :: (a -> b -> Bool) -> ExpF a -> ExpF b -> Bool #

Eq a => Eq (ExpF a) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

(==) :: ExpF a -> ExpF a -> Bool #

(/=) :: ExpF a -> ExpF a -> Bool #

Show a => Show (ExpF a) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

showsPrec :: Int -> ExpF a -> ShowS #

show :: ExpF a -> String #

showList :: [ExpF a] -> ShowS #

HasDelta (Exp Delta) Source # 
Instance details

Defined in Text.EDE.Internal.Types

Methods

delta :: Exp Delta -> Delta #

fromValue :: Value -> Maybe Object Source #

Unwrap a Value to an Object safely.

See Aeson's documentation for more details.

fromPairs :: [Pair] -> Object Source #

Create an Object from a list of name/value Pairs.

See Aeson's documentation for more details.