X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Ffirst.tex;fp=dsl%2Ffirst.tex;h=2bc712db506102cde27d3c789ee24a28e0c5d02d;hb=5c7ffbabc8f4fe9d21b4ab0095155ee87e32ed6e;hp=313b14f151f692a9215c5148acf6ab8bf8c511f3;hpb=5a89c717ca17b6abdc01fbf0720eb87e092b1b5a;p=phd-thesis.git diff --git a/dsl/first.tex b/dsl/first.tex index 313b14f..2bc712d 100644 --- a/dsl/first.tex +++ b/dsl/first.tex @@ -57,7 +57,8 @@ It does so by providing an implementation in \gls{TH} for a typical \gls{DSL} wi Furthermore, we show that by utilising quasiquotation, there is hardly any burden on the syntax. Finally, the chapter also serves as a gentle introduction to \gls{TH} and reflects on the process of using \gls{TH}. -\section{Tagless-final embedding} +\section{Tagless-final embedding}% +\label{sec:tagless-final} Tagless-final embedding is an upgrade to standard shallow embedding achieved by lifting all language construct functions to type classes. As a result, views on the \gls{DSL} are data types implementing these classes. @@ -789,7 +790,7 @@ The scaffolding---e.g.\ generating the pairs, sums and injections---for embeddin The key difference to our approach is that we specialise the implementation for each of the interpretations instead of providing a general implementation of data type handling operations. Furthermore, our implementation does not require a generic function to trace all constructors, resulting in problems with (mutual) recursion. -\Citet{young_adding_2021} added pattern matching to a deeply \gls{EDSL} using a compiler plugin. +\Citet{young_adding_2021} added pattern matching to a deeply embedded \gls{DSL} using a compiler plugin. This plugin implements an \haskellinline{externalise :: a -> E a} function that allows lifting all machinery required for pattern matching automatically from the host language to the \gls{DSL}. Under the hood, this function translates the pattern match to constructors, deconstructors, and constructor predicates. The main difference with this work is that it requires a compiler plugin while our metaprogramming approach works on any compiler supporting a metaprogramming system similar to \gls{TH}. @@ -807,7 +808,7 @@ They all differ slightly in functionality from our domain and can be divided int Using \gls{TH} or other metaprogramming systems it is possible to add extra code to your program. The original \gls{TH} paper showed that it is possible to create variadic functions such as \haskellinline{printf} using \gls{TH} that would be almost impossible to define without \citep{sheard_template_2002}. \Citet{hammond_automatic_2003} used \gls{TH} to generate parallel programming skeletons. -In practise, this means that the programmer selects a skeleton and, at compile time, the code is massaged to suit the pattern and information about the environment is inlined for optimisation. +In practice, this means that the programmer selects a skeleton and, at compile time, the code is massaged to suit the pattern and information about the environment is inlined for optimisation. \Citet{polak_automatic_2006} implemented automatic GUI generation using \gls{TH}. \Citet{duregard_embedded_2011} wrote a parser generator using \gls{TH} and the custom quasiquoting facilities. @@ -850,7 +851,7 @@ The original \gls{TH} quasiquotation paper \citep{mainland_why_2007} shows how t Also, \citet{kariotis_making_2008} used \gls{TH} to automatically construct monad stacks without having to resort to the monad transformers library which requires advanced type system extensions. \Citet{najd_everything_2016} uses the compile time to be able to do normalisation for a \gls{DSL}, dubbing it \glspl{QDSL}. -They utilise the quasiquation facilities of \gls{TH} to convert \gls{HASKELL} \gls{DSL} code to constructs in the \gls{DSL}, applying optimisations such as eliminating lambda abstractions and function applications along the way. +They utilise the quasiquotation facilities of \gls{TH} to convert \gls{HASKELL} \gls{DSL} code to constructs in the \gls{DSL}, applying optimisations such as eliminating lambda abstractions and function applications along the way. \Citet{egi_embedding_2022} extended \gls{HASKELL} to support non-free data type pattern matching---i.e.\ data type with no standard form, e.g.\ sets, graphs---using \gls{TH}. Using quasiquotation, they make a complicated embedding of non-linear pattern matching available through a simple lens.