\input{subfilepreamble}
+\setcounter{chapter}{0}
+
\begin{document}
+\input{subfileprefix}
\chapter{Deep embedding with class}%
\label{chp:classy_deep_embedding}
-
-\input{subfileprefix}
-
\begin{chapterabstract}
The two flavours of \gls{DSL} embedding are shallow and deep embedding.
In functional languages, shallow embedding models the language constructs as functions in which the semantics are embedded.
It can be stated that the language constructs are embedded in the functions that form a semantics.
If one wants to add a language construct, all semantics functions must be revisited and revised to avoid ending up with partial functions.
-This juxtaposition has been known for many years \citep{reynolds_user-defined_1978} and discussed by many others \citep{krishnamurthi_synthesizing_1998} but most famously dubbed the \emph{expression problem} by Wadler \citep{wadler_expression_1998}:
+This juxtaposition has been known for many years \citep{reynolds_user-defined_1978} and discussed by many others \citep{krishnamurthi_synthesizing_1998} but most famously dubbed the \emph{expression problem} by \citet{wadler_expression_1998}:
\begin{quote}
The \emph{expression problem} is a new name for an old problem.
This paper differs from those approaches in the sense that it does not require a core language in which all extensions need to be expressible.
\subsection{Comparison}
-\todo[inline]{text moet beter}
No \gls{DSL} embedding technique is the silver bullet.
\Citet{sun_compositional_2022} provided a thorough comparison of embedding techniques including more axes than just the two stated in the expression problem.
Giving an instance for \haskelllhstexinline{Interp} for \haskelllhstexinline{DataType} that uses the extensions \haskelllhstexinline{e_1, e2, ...} and depends on interpretations \haskelllhstexinline{i_1,i_2, ...} is done as follows:
\begin{lstHaskellLhstex}
-instance ( UsingExt '[e_1, e_2, ...] s
- , DependsOn '[i_1, i_2, ...] s
- ) => Interp (DataType s) where
+instance ( UsingExt '[e_1, e_2, ...] s, DependsOn '[i_1, i_2, ...] s)
+ => Interp (DataType s) where
...
\end{lstHaskellLhstex}
With these enhancements, there is hardly any boilerplate required to use classy deep embedding.
The \haskelllhstexinline{Record} data type; the \haskelllhstexinline{CreateRecord} type class; and the \haskelllhstexinline{UsingExt} and \haskelllhstexinline{DependsOn} type families can be provided as a library only requiring the programmer to create the extension constructors with their respective implementations and smart constructors for language construct extensions.
-The source code for this extension can be found here: \url{https://gitlab.com/mlubbers/classydeepembedding}.
+The source code for this extension can be found here: \url{https://gitlab.com/mlubbers/classydeepembedding}.\footnote{Lubbers, M. (2022): Library and examples for enhanced classy deep embedding.\ Zenodo.\ \href{https://doi.org/10.5281/zenodo.7277498}{10.5281/zenodo.7277498}.}
+It contains examples for expressions, expressions using \glspl{GADT}, detection of sharing in expressions (modelled after \citet{kiselyov_implementing_2011}), a \gls{GADT} version of sharing detection, and a region \gls{DSL} (modelled after \citet{sun_compositional_2022}).
\section{Data types and definitions}%
\label{sec:cde:appendix}