tvl-depot/users/Profpatsch/ini/ini.dhall
Profpatsch 3c3713c69f refactor(users/Profpatsch/aerc): move ini stuff out
First shot at generating a dhall FFI standard.

Change-Id: I1cdf7eeaa6b2668a49282315f308a8e51abd0cf6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5887
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2022-06-19 13:29:02 +00:00

36 lines
1 KiB
Text

let lib = ../dhall/lib.dhall
let NameVal = λ(T : Type) → { name : Text, value : T }
let ValueList = λ(T : Type) → List (NameVal T)
let Section = ValueList Text
let Sections = ValueList Section
let Ini = { globalSection : Section, sections : Sections }
let
-- Takes to INI files and merges their global sections and their section lists,
-- without duplicating by section name.
appendInis =
λ(inis : List Ini) →
{ globalSection =
lib.List/concat
(NameVal Text)
(lib.List/map Ini Section (λ(i : Ini) → i.globalSection) inis)
, sections =
lib.List/concat
(NameVal Section)
(lib.List/map Ini Sections (λ(i : Ini) → i.sections) inis)
}
: Ini
let
-- Signatures of functions that are input via FFI.
Externs =
{ -- given a dsl of functions to create an Ini, render the ini file
renderIni : Ini → Text
}
in { NameVal, ValueList, Section, Sections, Ini, appendInis, Externs }