headroom-0.3.1.0: License Header Manager

Copyright(c) 2019-2020 Vaclav Svejcar
LicenseBSD-3-Clause
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.Variables

Contents

Description

Module containing costructor and useful functions for the Variables data type.

Synopsis

Constructing Variables

mkVariables Source #

Arguments

:: [(Text, Text)]

pairs of key-value

-> Variables

constructed variables

Constructor function for Variables data type.

>>> mkVariables [("key1", "value1")]
Variables (fromList [("key1","value1")])

dynamicVariables Source #

Arguments

:: CurrentYear

current year

-> Variables

map of dynamic variables

Dynamic variables that are common for all parsed files.

  • _current_year - current year

Parsing Variables

parseVariables Source #

Arguments

:: MonadThrow m 
=> [Text]

list of raw variables

-> m Variables

parsed variables

Parses variables from raw input in key=value format.

>>> parseVariables ["key1=value1"]
Variables (fromList [("key1","value1")])

Processing Variables

compileVariables Source #

Arguments

:: MonadThrow m 
=> Variables

input variables to compile

-> m Variables

compiled variables

Compiles variable values that are itself mini-templates, where their variables will be substituted by other variable values (if possible). Note that recursive variable reference and/or cyclic references are not supported.

>>> compileVariables $ mkVariables [("name", "John"), ("msg", "Hello, {{ name }}")]
Variables (fromList [("msg","Hello, John"),("name","John")])