headroom-0.4.0.0: License Header Manager
Copyright(c) 2019-2021 Vaclav Svejcar
LicenseBSD-3-Clause
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.Configuration.Enrich

Description

This module contains mini-DSL for enrichment of generated YAML configurations, i.e. replacing default values with real ones, etc. This is intentionally done without the Data.Yaml and parsing, because that way all comments inside YAML file would be lost.

Synopsis

Data Types

newtype Enrich Source #

Simple wrapper representing single step of enrichment.

Constructors

Enrich 

Fields

Instances

Instances details
Semigroup Enrich Source # 
Instance details

Defined in Headroom.Configuration.Enrich

Monoid Enrich Source # 
Instance details

Defined in Headroom.Configuration.Enrich

data ValueType Source #

Represents type of the field value.

Constructors

Array

type of YAML array

String

type of YAML string

Instances

Instances details
Eq ValueType Source # 
Instance details

Defined in Headroom.Configuration.Enrich

Show ValueType Source # 
Instance details

Defined in Headroom.Configuration.Enrich

Field Generators

withArray Source #

Arguments

:: ToJSON a 
=> [a]

input list used as value

-> Text

field name

-> (ValueType, Text)

generated fields as (valueType, generatedField)

Generates YAML array field from given list and field name.

withText Source #

Arguments

:: Text

input text value

-> Text

field name

-> (ValueType, Text)

generated fields as (valueType, generatedField)

Generates YAML string from given text value and field name.

Field Manipulation

replaceEmptyValue Source #

Arguments

:: Text

field name

-> (Text -> (ValueType, Text))

field value generator function

-> Enrich

resulting enrichment step

Replaces empty value of given field with actual generated value.