X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=appx%2Fc4hp.tex;h=c610e92a42d14081aac2b651be27c6c75040b933;hb=9778c30bde0ac05c50b7664aba1f3faad6682ef3;hp=8ee7fb1eb754d34ae2dd64c31e58471865b4ed41;hpb=5702796e5885e85b9e8dcc0d5160dccb9386b05f;p=phd-thesis.git diff --git a/appx/c4hp.tex b/appx/c4hp.tex index 8ee7fb1..c610e92 100644 --- a/appx/c4hp.tex +++ b/appx/c4hp.tex @@ -8,9 +8,9 @@ \chapter{Clean for Haskell programmers}% \label{chp:clean_for_haskell_programmers} -This appendix is meant give people who are familiar with the \gls{FP} language \gls{HASKELL} a consise overview of the programming language \gls{CLEAN} and how it differs from \gls{HASKELL}. +This appendix is meant give people who are familiar with the \gls{FP} language \gls{HASKELL} a concise overview of the programming language \gls{CLEAN} and how it differs from \gls{HASKELL}. The goal is to support the reader when reading \gls{CLEAN} code. -\Cref{tbl:syn_clean_haskell} shows frequently occuring \gls{CLEAN} language elements on the left side and their \gls{HASKELL} equivalent on the right side. +\Cref{tbl:syn_clean_haskell} shows frequently occurring \gls{CLEAN} language elements on the left side and their \gls{HASKELL} equivalent on the right side. Obviously, this summary is not exhaustive. Some \gls{CLEAN} language elements that are not easily translatable to \gls{HASKELL} and thus do not occur in the summary following below. We hope you enjoy these notes and that it aids you in reading \gls{CLEAN} programs. @@ -21,10 +21,10 @@ Fast-forward thirty years, \gls{CLEAN} is now a robust language with state-of-th Initially, when it was used mostly as an intermediate language, it had a fairly spartan syntax. However, over the years, the syntax got friendlier and it currently it looks a lot like \gls{HASKELL}. -In the past, a \emph{double-edged} fronted even existed that allowed \gls{CLEAN} to be extended with \gls{HASKELL98} syntax and vice versa \citep{van_groningen_exchanging_2010}, however this frontend is no longer maintained. +In the past, a \emph{double-edged} fronted even existed that allowed \gls{CLEAN} to be extended with \gls{HASKELL}98 syntax and vice versa \citep{van_groningen_exchanging_2010}, however this frontend is no longer maintained. This chapter gives only a brief syntactical and functional comparison. A complete specification of the \gls{CLEAN} language can be found in the latest language report \citep{plasmeijer_clean_2021}. -Much of this is based on work by Achten, although that was based on \gls{CLEAN} 2.1 and \gls{HASKELL98} \citep{achten_clean_2007}. +Much of this is based on work by Achten, although that was based on \gls{CLEAN} 2.1 and \gls{HASKELL}98 \citep{achten_clean_2007}. When \gls{HASKELL} is mentioned we actually mean \gls{GHC}'s \gls{HASKELL}\footnote{If an extension is enabled, a footnote is added stating that \GHCmod{SomeExtension} is required.} and by \gls{CLEAN} we mean \gls{CLEAN} 3.1's compiler with the \gls{ITASK} extensions. \section{Features} @@ -43,7 +43,7 @@ In \gls{HASKELL}, in patterns, strictness is enforced using \haskellinline{!}\re Within functions, the strict let (\cleaninline{#!}) is used to force evaluate an expression, in \gls{HASKELL} \haskellinline{seq} or \haskellinline{\$!} is used for this. \subsection{Uniqueness typing} -Types in \gls{CLEAN} may be \emph{unique}, which means that they cannot be shared \citep{barendsen_uniqueness_1996}. +Types in \gls{CLEAN} may be \emph{unique}, which means that instances of the type cannot be shared \citep{barendsen_uniqueness_1996}. The uniqueness type system allows the compiler to generate efficient code because unique data structures can be destructively updated. Furthermore, uniqueness typing serves as a model for side effects as well \citep{achten_high_1993,achten_ins_1995}. \Gls{CLEAN} uses the \emph{world-as-value} paradigm where \cleaninline{World} represents the external environment and is always unique \citep{backus_introduction_1990}. @@ -94,7 +94,7 @@ readChars file \end{lstClean} \subsection{Generics} -Polytypic functions \citep{jeuring_polytypic_1996}---also known as generic or kind-indexed fuctions---are built into \gls{CLEAN} \citep[\citesection{7.1}]{plasmeijer_clean_2021}\citep{alimarine_generic_2005} whereas in \gls{HASKELL} they are implemented as a library \citep[\citesection{6.19.1}]{ghc_team_ghc_2021}. +Polytypic functions \citep{jeuring_polytypic_1996}---also known as generic or kind-indexed functions---are built into \gls{CLEAN} \citep[\citesection{7.1}]{plasmeijer_clean_2021}\citep{alimarine_generic_2005} whereas in \gls{HASKELL} they are implemented as a library \citep[\citesection{6.19.1}]{ghc_team_ghc_2021}. The syntax of the built-in generics of \gls{CLEAN} is very similar to that of Generic H$\forall$skell \citep{hinze_generic_2003}. %When calling a generic function, the kind must always be specified and depending on the kind, the function may require more arguments.