From ca79758b48368a9c6d025aecc0d5724e99353a1f Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 24 May 2023 02:16:53 +0200 Subject: [PATCH] tex: add stuff on dhall --- tex/references.bib | 8 ++++++++ tex/text.tex | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tex/references.bib b/tex/references.bib index 60a18cf..e102cc4 100644 --- a/tex/references.bib +++ b/tex/references.bib @@ -79,6 +79,14 @@ note={{Available from: \url{https://dhall-lang.org}. [viewed 2023-05-17]}}, } +@misc{dhallprelude, + howpublished = {[online]}, + title = {{Prelude-v23.0.0}}, + author = {{The Dhall Language Contributors}}, + year = 2023, + note={{Available from: \url{https://store.dhall-lang.org/Prelude-v23.0.0/}. [viewed 2023-05-24]}}, +} + @misc{dhallnorm, howpublished = {[online]}, title = {{Safety Guarantees}}, diff --git a/tex/text.tex b/tex/text.tex index b17d099..94ce9ea 100644 --- a/tex/text.tex +++ b/tex/text.tex @@ -612,7 +612,27 @@ Figure~\ref{fig:dhallschema}. The \texttt{let} statement declares a variable called \texttt{Schema} and assigns it the result of the expression on the right side of the equals sign, which has for practical reasons been trimmed and is displayed without the \emph{default} block, which is instead shown in its own -Figure~\ref{fig:dhallschemadefault}. +Figure~\ref{fig:dhallschemadefaults}. + +The main configuration is comprised of both raw attributes and child records, +which allows for grouping of related functionality. For instance, configuration +settings pertaining mailserver setup are grouped in a record named +\textbf{Mailer}. Its attribute \textbf{Enabled} is annotated as \textbf{Bool}, +which was deemed appropriate for a on-off switch-like functionality, with the +only permissible values being either \emph{True} or \emph{False}. Do note that +in Dhall \[true != True\], since \textbf{True} is internally a Bool constant, +which is built into Dhall (check out ``The Prelude''~\cite{dhallprelude}), +while \textbf{true} is evaluated as an \emph{unbound} variable, that is, a +variable \emph{not} defined in the current \emph{scope} and thus not +\emph{present} in the current scope. + +Another one of specialties of Dhall is that $==$ and $!=$ equality operators +only work on values of type \texttt{Bool}, which for example means that +variables of type \texttt{Natural} (\texttt{uint}) or \texttt{Text} +(\texttt{string}) cannot be compared directly as in other languages, which +either leaves the work for a higher-level language (such as Go), or from the +perspective of the Dhall authors, \emph{enums} are promoted when the value +matters. \begin{figure}[h] \begin{varwidth}