ginger-0.8.4.0: An implementation of the Jinja2 template language in Haskell

Safe HaskellNone
LanguageHaskell2010

Text.Ginger.Run.FuncUtils

Synopsis

Documentation

unaryFunc :: forall m h p. Monad m => (GVal (Run p m h) -> GVal (Run p m h)) -> Function (Run p m h) Source #

binaryFunc :: forall m h p. Monad m => (GVal (Run p m h) -> GVal (Run p m h) -> GVal (Run p m h)) -> Function (Run p m h) Source #

ignoreArgNames :: ([a] -> b) -> [(c, a)] -> b Source #

variadicNumericFunc :: Monad m => Scientific -> ([Scientific] -> Scientific) -> [(Maybe Text, GVal (Run p m h))] -> Run p m h (GVal (Run p m h)) Source #

unaryNumericFunc :: Monad m => Scientific -> (Scientific -> Scientific) -> [(Maybe Text, GVal (Run p m h))] -> Run p m h (GVal (Run p m h)) Source #

variadicStringFunc :: Monad m => ([Text] -> Text) -> [(Maybe Text, GVal (Run p m h))] -> Run p m h (GVal (Run p m h)) Source #

extractArgs :: [Text] -> [(Maybe Text, a)] -> (HashMap Text a, [a], HashMap Text a, [Text]) Source #

Match args according to a given arg spec, Python style. The return value is a triple of (matched, args, kwargs, unmatchedNames), where matches is a hash map of named captured arguments, args is a list of remaining unmatched positional arguments, kwargs is a list of remaining unmatched named arguments, and unmatchedNames contains the argument names that haven't been matched.

extractArgsT :: ([Maybe a] -> b) -> [Text] -> [(Maybe Text, a)] -> Either ([a], HashMap Text a, [Text]) b Source #

Parse argument list into type-safe argument structure.

extractArgsL :: [Text] -> [(Maybe Text, a)] -> Either ([a], HashMap Text a, [Text]) [Maybe a] Source #

Parse argument list into flat list of matched arguments.

extractArgsDefL :: [(Text, a)] -> [(Maybe Text, a)] -> Either ([a], HashMap Text a, [Text]) [a] Source #

injectDefaults :: [a] -> [Maybe a] -> [a] Source #