directory structure
authorMart Lubbers <mart@martlubbers.net>
Fri, 7 Oct 2022 13:12:13 +0000 (15:12 +0200)
committerMart Lubbers <mart@martlubbers.net>
Fri, 7 Oct 2022 13:12:13 +0000 (15:12 +0200)
86 files changed:
appendix/bytecode.tex [deleted file]
appx/.chktexrc [moved from appendix/.chktexrc with 100% similarity]
appx/bytecode.tex [new file with mode: 0644]
appx/clean_for_haskell_programmers.tex [moved from appendix/clean_for_haskell_programmers.tex with 93% similarity]
appx/latexmkrc [moved from appendix/latexmkrc with 100% similarity]
appx/lst/.gitignore [moved from appendix/lst/.gitignore with 100% similarity]
appx/lst/Makefile [moved from appendix/lst/Makefile with 100% similarity]
appx/lst/example_deep.hs [moved from appendix/lst/example_deep.hs with 100% similarity]
appx/lst/expr_gadt.hs [moved from appendix/lst/expr_gadt.hs with 100% similarity]
appx/lst/expr_gadt.icl [moved from appendix/lst/expr_gadt.icl with 100% similarity]
appx/lst/generic_eq.icl [moved from appendix/lst/generic_eq.icl with 100% similarity]
appx/lst/generic_print.icl [moved from appendix/lst/generic_print.icl with 100% similarity]
appx/mtask_aux.tex [moved from appendix/mtask_aux.tex with 98% similarity]
back/acknowledgements.tex [moved from backmatter/acknowledgements.tex with 95% similarity]
back/curriculum_vitae.tex [moved from backmatter/curriculum_vitae.tex with 96% similarity]
back/research_data_management.tex [moved from backmatter/research_data_management.tex with 96% similarity]
back/samenvatting.tex [moved from backmatter/samenvatting.tex with 85% similarity]
back/summary.tex [moved from backmatter/summary.tex with 85% similarity]
concl/conclusion.tex [moved from conclusion/conclusion.tex with 79% similarity]
domain-specific_languages/strongly-typed_multi-view_stack-based_computations.tex [deleted file]
dsl/.chktexrc [moved from domain-specific_languages/.chktexrc with 100% similarity]
dsl/class_deep_embedding.tex [moved from domain-specific_languages/class_deep_embedding.tex with 98% similarity]
dsl/dsl_techniques.tex [moved from domain-specific_languages/dsl_techniques.tex with 97% similarity]
dsl/first-class_datatypes.tex [moved from domain-specific_languages/first-class_datatypes.tex with 99% similarity]
front/by.eps [moved from frontmatter/by.eps with 100% similarity]
front/cc.eps [moved from frontmatter/cc.eps with 100% similarity]
front/dedication.tex [moved from frontmatter/dedication.tex with 100% similarity]
front/motto.tex [moved from frontmatter/motto.tex with 100% similarity]
front/nd.eps [moved from frontmatter/nd.eps with 100% similarity]
front/titlepage.tex [moved from frontmatter/titlepage.tex with 87% similarity]
glossaries.tex
intro/.chktexrc [moved from tiered_vs._tierless_programming/.chktexrc with 100% similarity]
intro/hyponymy_of_dsls.tex [new file with mode: 0644]
intro/img/orcid.png [moved from introduction/img/orcid.png with 100% similarity]
intro/introduction.tex [moved from introduction/introduction.tex with 80% similarity]
intro/iot-layers.tex [moved from introduction/iot-layers.tex with 100% similarity]
intro/tosd.tex [moved from introduction/tosd.tex with 100% similarity]
intro/traditional.tex [moved from introduction/traditional.tex with 100% similarity]
lstlangarduino.sty
lstlanghaskell.sty
lstlanghaskelllhstex.sty [deleted file]
other.bib
preamble.tex
process_bib.sh [new file with mode: 0755]
self.bib
thesis.tex
tiered_vs._tierless_programming/img/arch.pdf [deleted file]
tiered_vs._tierless_programming/img/bar_chart.pdf [deleted file]
tiot.bib
top/.chktexrc [moved from mtask/.chktexrc with 100% similarity]
top/beyond_microprocessors.tex [moved from mtask/beyond_microprocessors.tex with 57% similarity]
top/integration.tex [moved from mtask/integration.tex with 68% similarity]
top/interpreting.tex [moved from mtask/interpreting.tex with 71% similarity]
top/mtask.tex [moved from mtask/mtask.tex with 71% similarity]
top/mtask_by_example.tex [moved from mtask/mtask_by_example.tex with 86% similarity]
top/mtask_integration.tex [moved from introduction/hyponymy_of_dsls.tex with 100% similarity]
tvt/.chktexrc [new file with mode: 0644]
tvt/img/TempHistory.png [moved from tiered_vs._tierless_programming/img/TempHistory.png with 100% similarity]
tvt/img/TempHistory1.png [moved from tiered_vs._tierless_programming/img/TempHistory1.png with 100% similarity]
tvt/img/TempHistory2.png [moved from tiered_vs._tierless_programming/img/TempHistory2.png with 100% similarity]
tvt/img/arch.drawio [moved from tiered_vs._tierless_programming/img/arch.drawio with 100% similarity]
tvt/img/cwss_web.png [moved from tiered_vs._tierless_programming/img/cwss_web.png with 100% similarity]
tvt/img/cwts.png [moved from tiered_vs._tierless_programming/img/cwts.png with 100% similarity]
tvt/img/cwtsDiagram.png [moved from tiered_vs._tierless_programming/img/cwtsDiagram.png with 100% similarity]
tvt/img/cwtsDiagram2.png [moved from tiered_vs._tierless_programming/img/cwtsDiagram2.png with 100% similarity]
tvt/img/devTaskDiagram.png [moved from tiered_vs._tierless_programming/img/devTaskDiagram.png with 100% similarity]
tvt/img/devTaskDiagram2.png [moved from tiered_vs._tierless_programming/img/devTaskDiagram2.png with 100% similarity]
tvt/img/gen_stacked_barchart.py [moved from tiered_vs._tierless_programming/img/gen_stacked_barchart.py with 100% similarity]
tvt/img/iTaskTemp.png [moved from tiered_vs._tierless_programming/img/iTaskTemp.png with 100% similarity]
tvt/img/iTaskTemp1.png [moved from tiered_vs._tierless_programming/img/iTaskTemp1.png with 100% similarity]
tvt/img/iTaskTemp2.png [moved from tiered_vs._tierless_programming/img/iTaskTemp2.png with 100% similarity]
tvt/img/iTaskTempRemote.png [moved from tiered_vs._tierless_programming/img/iTaskTempRemote.png with 100% similarity]
tvt/img/mTaskTemp.png [moved from tiered_vs._tierless_programming/img/mTaskTemp.png with 100% similarity]
tvt/img/prss.jpg [moved from tiered_vs._tierless_programming/img/prss.jpg with 100% similarity]
tvt/img/readTempTask.png [moved from tiered_vs._tierless_programming/img/readTempTask.png with 100% similarity]
tvt/img/sensordata.png [moved from tiered_vs._tierless_programming/img/sensordata.png with 100% similarity]
tvt/img/simpleTempSensor.png [moved from tiered_vs._tierless_programming/img/simpleTempSensor.png with 100% similarity]
tvt/img/todolist1.png [moved from tiered_vs._tierless_programming/img/todolist1.png with 100% similarity]
tvt/img/todolist3.png [moved from tiered_vs._tierless_programming/img/todolist3.png with 100% similarity]
tvt/img/todolist4.png [moved from tiered_vs._tierless_programming/img/todolist4.png with 100% similarity]
tvt/img/todolist5.png [moved from tiered_vs._tierless_programming/img/todolist5.png with 100% similarity]
tvt/img/todolist6.png [moved from tiered_vs._tierless_programming/img/todolist6.png with 100% similarity]
tvt/img/todolist7.png [moved from tiered_vs._tierless_programming/img/todolist7.png with 100% similarity]
tvt/img/web_iot.png [moved from tiered_vs._tierless_programming/img/web_iot.png with 100% similarity]
tvt/img/wemos.jpg [moved from tiered_vs._tierless_programming/img/wemos.jpg with 100% similarity]
tvt/tvt.tex [moved from tiered_vs._tierless_programming/smart_campus.tex with 77% similarity]

diff --git a/appendix/bytecode.tex b/appendix/bytecode.tex
deleted file mode 100644 (file)
index b46e53e..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-\documentclass[../thesis.tex]{subfiles}
-
-\begin{document}
-\ifSubfilesClassLoaded{
-       \pagenumbering{arabic}
-}{}
-
-\myappendix{chp:bytecode_instruction_set}{Bytecode instruction set}%
-\todo[inline]{formatting}
-
-\begin{tabular}{ll}
-       $l$ & label\\
-       $w_r$ & return width\\
-       $w_a$ & argument width\\
-       $fp$ & frame pointer\\
-       $sp$ & stack pointer\\
-       $pc$ & program counter\\
-\end{tabular}
-
-Bytecode is byte encoded, stack has 16-bit cells.
-Longs and reals are stored with the MSB first.
-
-\footnotesize
-\begin{longtable}{lllll}
-       \caption{\normalsize Semantics for the bytecode instructions\label{tbl:instr_task}}
-       \endfirsthead%
-       \caption{\normalsize Semantics for the bytecode instructions (cont.)}
-       \endhead%
-       \endfoot%
-       \endlastfoot%
-       \toprule
-       Instr. & Args & Semantics & sp & pc\\
-       
-       \midrule
-       \texttt{return}   & $w_r~w_a$           & $st[fp\shortminus{}w_a\shortminus{}3+i] = st[fp+1]$ & $st[fp\shortminus{}w_a\shortminus{}3+w_r]$ & $st[fp\shortminus{}w_a\shortminus{}1]$\\
-                                     &                     & {\bf for all} $i\in\{0..w_r\}$\\
-                                     &                     & $fp = st[fp\shortminus{}w_a\shortminus{}2]$\\
-       \texttt{jumpF}    & $l$                 & & $sp\shortminus{}1$ & $\left\{\begin{array}{ll} pc+1 & \textrm{\bf if } st[sp\shortminus{}1]\\l & \textrm{\bf otherwise}\end{array}\right.$\\
-       \texttt{jump}     & $l$                 & & $sp\shortminus{}1$ & $l$\\
-       \texttt{jumpSR}   & $w_a~l$             & $st[sp\shortminus{}w_a\shortminus{}1]=pc+2$ & & $l$\\
-       \texttt{tailCall} & $w_{a_1}~w_{a_2}~l$ & $rotate\:(w_{a_1}+3+w_{a_2},w_{a_2})$         & $fp$             & $jl$\\
-                                         &                     & $fp = fp-w_{a_1}+w_{a_2}$\\
-                                         &                     & \multicolumn{3}{l}{{\bf where} $w_{a_1}$ is the width of the current function and $w_{a_2}$ the width of the called function}\\
-       \texttt{arg}      & $i$                 & $st[sp] = st[fp-1-i]$ & $sp+1$\\
-       \texttt{push}     & $n~b_0\ldots b_n$   & $st[sp+i] = s[i]$                             & $sp+n$           & $pc+2+n$\\
-                                     &                     & {\bf for all} $i\in\{0..n\}$\\
-%      \midrule
-       \texttt{pop}      & $n$                 & & $sp-n$           & $pc+2$\\
-%      \midrule
-       \texttt{rot}      & $d~n$               & $rotate\:(d, n)$                              & $sp$             & $pc+3$\\
-%      \midrule
-       \texttt{dup}      &                     & $st[sp] = st[sp-1]$                           & $sp+1$           & $pc+1$\\
-%      \midrule
-       \texttt{pushPtrs} &                     & $st[sp] = sp$                                 & $sp+3$           & $pc+1$\\
-                                         &                     & $st[sp+1] = fp$\\
-                         &                     & $st[sp+2] = 0$\\
-%      \midrule
-       \texttt{unOp}     &                     & $st[sp-1] = \diamond{}st[sp-1]$                & $sp$             & $pc+1$\\
-                                         &                     & \multicolumn{3}{l}{{\bf for all} $\diamond\in\{\neg\}$}\\
-%      \midrule
-       \texttt{binOp}    &                     & $st[sp-2] = st[sp-2] \mathbin{\oplus} st[sp-1]$         & $sp-1$           & $pc+1$\\
-                                         &                     & \multicolumn{3}{l}{{\bf for all} $\oplus\in\{+, -, *, /, \wedge, \vee, \equiv, \not\equiv, \leq, \geq, <, >\}$}\\
-%      \midrule
-       \texttt{mkTask}   & \texttt{Stable\textsubscript{n}} & $st[sp-n-1] = node (stable,$              & $sp-n+1$ & $pc+2$\\
-                                         &                                  & $\qquad\qquad st[sp-1], \ldots, st[sp-n-1])$\\
-       \texttt{mkTask}   & \texttt{Unstable\textsubscript{n}} & $st[sp-n-1] = node (unstable,$          & $sp-n+1$ & $pc+2$\\
-                                         &                                  & $\qquad\qquad st[sp-1], \ldots, st[sp-n-1])$\\
-%      \midrule
-%                 & \multicolumn{3}{l}{Unstable\textsubscript{n}} & st[sp-n-1] = node (unstable,          & sp-n+1 & pc+2\\
-%             & \multicolumn{3}{l}{} & \qquad\qquad st[sp-1], \textrm{\ldots}, st[sp-n-1])\\
-%      \midrule
-%
-%             & \multicolumn{3}{l}{ReadD        } & st[sp-1] \ \ = node (readd, st[sp-1])             &        & pc+2\\
-%      \midrule
-%             & \multicolumn{3}{l}{ReadA        } & st[sp-1] \ \ = node (reada, st[sp-1])             &        & pc+2\\
-%      \midrule
-%             & \multicolumn{3}{l}{Repeat       } & st[sp-1] \ \ = node (repeat, st[sp-1])              &        & pc+2\\
-%      \midrule
-%             & \multicolumn{3}{l}{Delay        } & st[sp-1] \ \ = node (delay, st[sp-1])             &        & pc+2\\
-%      \midrule
-%
-%             & \multicolumn{3}{l}{WriteD       } & st[sp-2] \ \ = node (writed, st[sp-1], st[sp-2])  & sp-1   & pc+2\\
-%      \midrule
-%             & \multicolumn{3}{l}{WriteA       } & st[sp-2] \ \ = node (writea, st[sp-1], st[sp-2])  & sp-1   & pc+2\\
-%      \midrule
-%             & \multicolumn{3}{l}{And          } & st[sp-2] \ \ = node (and, st[sp-1], st[sp-2])     & sp-1   & pc+2\\
-%      \midrule
-%             & \multicolumn{3}{l}{Or           } & st[sp-2] \ \ = node (or, st[sp-1], st[sp-2])      & sp-1   & pc+2\\
-%      \midrule
-%
-%             & \multicolumn{3}{l}{SdsSet i     } & st[sp-1] \ \ = node (sdsset,i, st[sp-1])          &        & pc+3\\
-%      \midrule
-%
-%             & \multicolumn{3}{l}{SdsGet i     } & st[sp]\ \ \ \ \ = node (sdsget, i)                & sp+1   & pc+3\\
-%      \midrule
-%             & \multicolumn{3}{l}{DHTTemp i    } & st[sp-1] \ \ = node (dhttemp, i)                  & sp+1   & pc+3\\
-%      \midrule
-%             & \multicolumn{3}{l}{DHTHumid i   } & st[sp-1] \ \ = node (dhthumid, i)                 & sp+1   & pc+3\\
-%      \midrule
-%
-%             & \multicolumn{3}{l}{Step aw jl   } & st[sp-1] \ \ = node (step, aw, jl, st[sp-1])      & sp-1   & pc+5\\
-       \bottomrule
-\end{longtable}
-
-\input{subfilepostamble}
-\end{document}
similarity index 100%
rename from appendix/.chktexrc
rename to appx/.chktexrc
diff --git a/appx/bytecode.tex b/appx/bytecode.tex
new file mode 100644 (file)
index 0000000..b6e13f8
--- /dev/null
@@ -0,0 +1,107 @@
+\documentclass[../thesis.tex]{subfiles}
+
+\begin{document}
+\ifSubfilesClassLoaded{
+       \pagenumbering{arabic}
+}{}
+
+\chapter{Bytecode instruction set}%
+\label{chp:bytecode_instruction_set}%
+\todo[inline]{formatting}
+
+\begin{tabular}{ll}
+       $l$ & label\\
+       $w_r$ & return width\\
+       $w_a$ & argument width\\
+       $fp$ & frame pointer\\
+       $sp$ & stack pointer\\
+       $pc$ & program counter\\
+\end{tabular}
+
+Bytecode is byte encoded, stack has 16-bit cells.
+Longs and reals are stored with the MSB first.
+
+\footnotesize
+%\begin{longtable}{lllll}
+%      \caption{\normalsize Semantics for the bytecode instructions\label{tbl:instr_task}}
+%      \endfirsthead%
+%      \caption{\normalsize Semantics for the bytecode instructions (cont.)}
+%      \endhead%
+%      \endfoot%
+%      \endlastfoot%
+%      \toprule
+%      Instr. & Args & Semantics & sp & pc\\
+%      
+%      \midrule
+%      \texttt{return}   & $w_r~w_a$           & $st[fp\shortminus{}w_a\shortminus{}3+i] = st[fp+1]$ & $st[fp\shortminus{}w_a\shortminus{}3+w_r]$ & $st[fp\shortminus{}w_a\shortminus{}1]$\\
+%                                    &                     & {\bf for all} $i\in\{0..w_r\}$\\
+%                                    &                     & $fp = st[fp\shortminus{}w_a\shortminus{}2]$\\
+%      \texttt{jumpF}    & $l$                 & & $sp\shortminus{}1$ & $\left\{\begin{array}{ll} pc+1 & \textrm{\bf if } st[sp\shortminus{}1]\\l & \textrm{\bf otherwise}\end{array}\right.$\\
+%      \texttt{jump}     & $l$                 & & $sp\shortminus{}1$ & $l$\\
+%      \texttt{jumpSR}   & $w_a~l$             & $st[sp\shortminus{}w_a\shortminus{}1]=pc+2$ & & $l$\\
+%      \texttt{tailCall} & $w_{a_1}~w_{a_2}~l$ & $rotate\:(w_{a_1}+3+w_{a_2},w_{a_2})$         & $fp$             & $jl$\\
+%                                        &                     & $fp = fp-w_{a_1}+w_{a_2}$\\
+%                                        &                     & \multicolumn{3}{p{.75\textwidth}}{{\bf where} $w_{a_1}$ is the width of the current function and $w_{a_2}$ the width of the called function}\\
+%      \texttt{arg}      & $i$                 & $st[sp] = st[fp-1-i]$ & $sp+1$\\
+%      \texttt{push}     & $n~b_0\ldots b_n$   & $st[sp+i] = s[i]$                             & $sp+n$           & $pc+2+n$\\
+%                                    &                     & {\bf for all} $i\in\{0..n\}$\\
+%%     \midrule
+%      \texttt{pop}      & $n$                 & & $sp-n$           & $pc+2$\\
+%%     \midrule
+%      \texttt{rot}      & $d~n$               & $rotate\:(d, n)$                              & $sp$             & $pc+3$\\
+%%     \midrule
+%      \texttt{dup}      &                     & $st[sp] = st[sp-1]$                           & $sp+1$           & $pc+1$\\
+%%     \midrule
+%      \texttt{pushPtrs} &                     & $st[sp] = sp$                                 & $sp+3$           & $pc+1$\\
+%                                        &                     & $st[sp+1] = fp$\\
+%                        &                     & $st[sp+2] = 0$\\
+%%     \midrule
+%      \texttt{unOp}     &                     & $st[sp-1] = \diamond{}st[sp-1]$                & $sp$             & $pc+1$\\
+%                                        &                     & \multicolumn{3}{l}{{\bf for all} $\diamond\in\{\neg\}$}\\
+%%     \midrule
+%      \texttt{binOp}    &                     & $st[sp-2] = st[sp-2] \mathbin{\oplus} st[sp-1]$         & $sp-1$           & $pc+1$\\
+%                                        &                     & \multicolumn{3}{l}{{\bf for all} $\oplus\in\{+, -, *, /, \wedge, \vee, \equiv, \not\equiv, \leq, \geq, <, >\}$}\\
+%%     \midrule
+%      \texttt{mkTask}   & \texttt{Stable\textsubscript{n}} & $st[sp-n-1] = node (stable,$              & $sp-n+1$ & $pc+2$\\
+%                                        &                                  & $\qquad\qquad st[sp-1], \ldots, st[sp-n-1])$\\
+%      \texttt{mkTask}   & \texttt{Unstable\textsubscript{n}} & $st[sp-n-1] = node (unstable,$          & $sp-n+1$ & $pc+2$\\
+%                                        &                                  & $\qquad\qquad st[sp-1], \ldots, st[sp-n-1])$\\
+%%     \midrule
+%%                & \multicolumn{3}{l}{Unstable\textsubscript{n}} & st[sp-n-1] = node (unstable,          & sp-n+1 & pc+2\\
+%%            & \multicolumn{3}{l}{} & \qquad\qquad st[sp-1], \textrm{\ldots}, st[sp-n-1])\\
+%%     \midrule
+%%
+%%            & \multicolumn{3}{l}{ReadD        } & st[sp-1] \ \ = node (readd, st[sp-1])             &        & pc+2\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{ReadA        } & st[sp-1] \ \ = node (reada, st[sp-1])             &        & pc+2\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{Repeat       } & st[sp-1] \ \ = node (repeat, st[sp-1])              &        & pc+2\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{Delay        } & st[sp-1] \ \ = node (delay, st[sp-1])             &        & pc+2\\
+%%     \midrule
+%%
+%%            & \multicolumn{3}{l}{WriteD       } & st[sp-2] \ \ = node (writed, st[sp-1], st[sp-2])  & sp-1   & pc+2\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{WriteA       } & st[sp-2] \ \ = node (writea, st[sp-1], st[sp-2])  & sp-1   & pc+2\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{And          } & st[sp-2] \ \ = node (and, st[sp-1], st[sp-2])     & sp-1   & pc+2\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{Or           } & st[sp-2] \ \ = node (or, st[sp-1], st[sp-2])      & sp-1   & pc+2\\
+%%     \midrule
+%%
+%%            & \multicolumn{3}{l}{SdsSet i     } & st[sp-1] \ \ = node (sdsset,i, st[sp-1])          &        & pc+3\\
+%%     \midrule
+%%
+%%            & \multicolumn{3}{l}{SdsGet i     } & st[sp]\ \ \ \ \ = node (sdsget, i)                & sp+1   & pc+3\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{DHTTemp i    } & st[sp-1] \ \ = node (dhttemp, i)                  & sp+1   & pc+3\\
+%%     \midrule
+%%            & \multicolumn{3}{l}{DHTHumid i   } & st[sp-1] \ \ = node (dhthumid, i)                 & sp+1   & pc+3\\
+%%     \midrule
+%%
+%%            & \multicolumn{3}{l}{Step aw jl   } & st[sp-1] \ \ = node (step, aw, jl, st[sp-1])      & sp-1   & pc+5\\
+%      \bottomrule
+%\end{longtable}
+
+\input{subfilepostamble}
+\end{document}
similarity index 93%
rename from appendix/clean_for_haskell_programmers.tex
rename to appx/clean_for_haskell_programmers.tex
index 4d78011..cc7873d 100644 (file)
@@ -7,7 +7,8 @@
 }{
 }
 
-\myappendix{chp:clean_for_haskell_programmers}{\texorpdfstring{\glsentrytext{CLEAN}}{Clean} for \texorpdfstring{\glsentrytext{HASKELL}}{Haskell} Programmers}%
+\chapter{\texorpdfstring{\glsentrytext{CLEAN}}{Clean} for \texorpdfstring{\glsentrytext{HASKELL}}{Haskell} Programmers}%
+\label{chp:clean_for_haskell_programmers}
 
 This note is meant to give people who are familiar with the functional programming language \gls{HASKELL} a consise overview of \gls{CLEAN} language elements and how they differ from \gls{HASKELL}.
 The goal is to support the reader when reading \gls{CLEAN} code.
@@ -70,7 +71,7 @@ f :: v:a u:b -> u:b, [v<=u]  // f works when a is less unique than b
 %:: T = T (Int -> *(*World -> *World)) // Writing :: T = T (Int *World -> *World) won't work
 
 \subsection{Expressions}
-Patterns in \gls{CLEAN} can be used as predicates as well~\cite[Chp.~3.4.3]{plasmeijer_clean_2021}.
+Patterns in \gls{CLEAN} can be used as predicates as well~\citep[Chp.~3.4.3]{plasmeijer_clean_2021}.
 Using the \cleaninline{=:} operator, a value can be tested against a pattern.
 Variable names are not allowed but wildcard patterns \cleaninline{\_} are.
 
@@ -86,7 +87,7 @@ ifAB x ifa ifb = if (x =: (A _)) ifa ifb
 
 Due to the nature of uniqueness typing, many functions in \gls{CLEAN} are state transition functions with possibly unique states.
 The \emph{let before} construct allows the programmer to specify sequential actions without having to invent unique names for the different versions of the state.
-\Cref{lst:let_before} shows an example of the usage of the \emph{let before} construct (adapted from~\cite[Chp.~3.5.4]{plasmeijer_clean_2021}).
+\Cref{lst:let_before} shows an example of the usage of the \emph{let before} construct (adapted from~\citep[Chp.~3.5.4]{plasmeijer_clean_2021}).
 
 \begin{lstClean}[label={lst:let_before},caption={Let before expression example.}]
 readChars :: *File -> ([Char], *File)
@@ -98,7 +99,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}~\cite[Chp.~7.1]{plasmeijer_clean_2021}\citep{alimarine_generic_2005} whereas in \gls{HASKELL} they are implemented as a library~\cite[Chp.~6.19.1]{ghc_team_ghc_2021}.
+Polytypic functions~\citep{jeuring_polytypic_1996}---also known as generic or kind-indexed fuctions---are built into \gls{CLEAN}~\citep[Chp.~7.1]{plasmeijer_clean_2021}\citep{alimarine_generic_2005} whereas in \gls{HASKELL} they are implemented as a library~\citep[Chp.~6.19.1]{ghc_team_ghc_2021}.
 The implementation of generics in \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.
 
@@ -110,12 +111,13 @@ Metadata about the types is available using the \cleaninline{of} syntax that giv
 
 \subsection{\texorpdfstring{\glsentrytext{GADT}}{GADT}s}
 \Glspl{GADT} are enriched data types that allow the type instantiation of the constructor to be explicitly defined~\citep{cheney_first-class_2003,hinze_fun_2003}.
-While \glspl{GADT} are not natively supported in \gls{CLEAN}, they can be simulated using embedding-projection pairs or equivalence types~\cite[Sec.~2.2]{cheney_lightweight_2002}.
+While \glspl{GADT} are not natively supported in \gls{CLEAN}, they can be simulated using embedding-projection pairs or equivalence types~\citep[Sec.~2.2]{cheney_lightweight_2002}.
 To illustrate this, \cref{lst:gadt_clean} shows an example \gls{GADT} that would be implemented in \gls{HASKELL} as done in \cref{lst:gadt_haskell}\requiresGHCmod{GADTs}.
 
-\lstinputlisting[language=Clean,firstline=4,label={lst:gadt_clean},caption={Expression \gls{GADT} using equivalence types in \gls{CLEAN}.}]{lst/expr_gadt.icl}
-\lstinputlisting[language=Haskell,style=haskell,firstline=4,label={lst:gadt_haskell},caption={Expression \gls{GADT} in \gls{HASKELL}.}]{lst/expr_gadt.hs}
+\lstinputlisting[language=Clean,firstline=4,lastline=24,label={lst:gadt_clean},caption={Expression \gls{GADT} using equivalence types in \gls{CLEAN}.}]{lst/expr_gadt.icl}
+\lstinputlisting[language={[Regular]Haskell},firstline=4,label={lst:gadt_haskell},caption={Expression \gls{GADT} in \gls{HASKELL}.}]{lst/expr_gadt.hs}
 
+\clearpage
 \section{Syntax}
 \begin{longtable}{p{.45\linewidth}p{.5\linewidth}}
        \caption[]{Syntactical differences between \gls{CLEAN} and \gls{HASKELL}.}%
@@ -226,6 +228,7 @@ To illustrate this, \cref{lst:gadt_clean} shows an example \gls{GADT} that would
        \cleaninline{:: R = \{ f :: t \}} & \haskellinline{data R = R \{ f :: t \}}\\
        \cleaninline{r = \{ f = e \}} & \haskellinline{r = R \{e\}}\\
        \cleaninline{r.f} & \haskellinline{f r}\\
+                                         & \haskellinline{r.f}\requiresGHCmod{Requires \gls{GHC} version 9.2.0 or higher}{OverloadedRecordDot}\\
        \cleaninline{r!f}\footnote{This operator allows for field selection from unique records.} & \haskellinline{(\\v->(f v, v)) r}\\
        \cleaninline{\{r \& f = e \}} & \haskellinline{r \{ f = e \}}\\
 
@@ -247,7 +250,7 @@ To illustrate this, \cref{lst:gadt_clean} shows an example \gls{GADT} that would
        \cleaninline{a = \{e \\\\ p <-: a\}} & \haskellinline{a = array (0, length a-1)}\\
                                             & \quad\haskellinline{[e \| (i, a) <- [0..] `zip` a]}\\
        \cleaninline{a.[i]} & \haskellinline{a!i}\\
-       \cleaninline{a![i]}\footnote{This operator allows for field selection from unique arrays.} & \haskellinline{(\v->(v!i, v)) a}\\
+       \cleaninline{a![i]}\footnote{This operator allows for field selection from unique arrays.} & \haskellinline{(\\v->(v!i, v)) a}\\
        \cleaninline{\{ a \& [i] = e\}} & \haskellinline{a//[(i, e)]}\\
 
        \midrule
similarity index 100%
rename from appendix/latexmkrc
rename to appx/latexmkrc
similarity index 100%
rename from appendix/lst/.gitignore
rename to appx/lst/.gitignore
similarity index 100%
rename from appendix/lst/Makefile
rename to appx/lst/Makefile
similarity index 98%
rename from appendix/mtask_aux.tex
rename to appx/mtask_aux.tex
index cd67dce..4a87974 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\myappendix{chp:mtask_aux}{Auxiliary \texorpdfstring{\glsentrytext{MTASK}}{mTask} type classes}
+\chapter{Auxiliary \texorpdfstring{\glsentrytext{MTASK}}{mTask} type classes}%
+\label{chp:mtask_aux}
 \lstset{basicstyle=\tt\footnotesize}
 \section{Peripherals}\label{sec:aux_peripherals}
 This section shows the peripherals not mentioned in \cref{chp:top4iot}.
similarity index 95%
rename from backmatter/acknowledgements.tex
rename to back/acknowledgements.tex
index 9c8c30c..71761d0 100644 (file)
@@ -4,7 +4,8 @@
 \ifSubfilesClassLoaded{
        \pagenumbering{arabic}
 }{}
-\mybackmatter{chp:acknowledgements}{Acknowledgements}%
+\chapter{Acknowledgements}%
+\label{chp:acknowledgements}
 %\begin{center}
 \noindent
 Funding: Teun de Groot, Ton van Heusden
@@ -36,7 +37,7 @@ Additionally, this thesis acknowledges the support of the Erasmus+ Key Action 2
 The information and views set out in this thesis are those of the author and do not necessarily reflect the official opinion of the European Union.
 Neither the European Union institutions and bodies nor any person acting on their behalf may be held responsible for the use which may be made of the information contained therein.
 
-Finally I want to thank all anonymous reviewers for the indispensable suggestions and remarks on all papers.
+Finally I want to thank all anonymous reviewers for the indispensable comments, suggestions and remarks on all papers.
 %\end{center}
 \input{subfilepostamble}
 \end{document}
similarity index 96%
rename from backmatter/curriculum_vitae.tex
rename to back/curriculum_vitae.tex
index 9deaada..30524cd 100644 (file)
@@ -4,7 +4,8 @@
 \ifSubfilesClassLoaded{
        \pagenumbering{arabic}
 }{}
-\mybackmatter{chp:curriculum_vitae}{Curriculum Vit\ae}%
+\chapter{Curriculum Vit\ae}%
+\label{chp:curriculum_vitae}
 Mart Lubbers
 
 \vspace{\baselineskip}
similarity index 96%
rename from backmatter/research_data_management.tex
rename to back/research_data_management.tex
index bd48373..0c826b0 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mybackmatter{chp:research_data_management}{Research Data Management}%
+\chapter{Research Data Management}%
+\label{chp:research_data_management}
 
 This thesis research has been carried out under the research data management policy of the Institute for Computing and Information Science of Radboud University, the Netherlands\footnote{\url{https://www.ru.nl/icis/research-data-management/}, last accessed \formatdate{20}{1}{2020}.}.
 
similarity index 85%
rename from backmatter/samenvatting.tex
rename to back/samenvatting.tex
index d980132..0c1ee31 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mybackmatter{chp:samenvatting}{Samenvatting}%
+\chapter{Samenvatting}%
+\label{chp:samenvatting}
 \selectlanguage{dutch}
 \begin{center}
 
similarity index 85%
rename from backmatter/summary.tex
rename to back/summary.tex
index f96ac22..7e4f260 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mybackmatter{chp:summary}{Summary}%
+\chapter{Summary}%
+\label{chp:summary}
 \begin{center}
 
 \noindent%
similarity index 79%
rename from conclusion/conclusion.tex
rename to concl/conclusion.tex
index 0dd6005..ea20f10 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:conclusion}{Coda}%
+\chapter{Coda}%
+\label{chp:conclusion}
 
 \input{subfilepostamble}
 \end{document}
diff --git a/domain-specific_languages/strongly-typed_multi-view_stack-based_computations.tex b/domain-specific_languages/strongly-typed_multi-view_stack-based_computations.tex
deleted file mode 100644 (file)
index 8ece8f8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-\documentclass[../thesis.tex]{subfiles}
-
-\begin{document}
-\ifSubfilesClassLoaded{
-       \pagenumbering{arabic}
-}{}
-
-\mychapter{chp:strongly-typed_multi-view_stack-based_computations}{Strongly-Typed Multi-View Stack-Based Computations}%
-TFP22
-
-\input{subfilepostamble}
-\end{document}
similarity index 98%
rename from domain-specific_languages/class_deep_embedding.tex
rename to dsl/class_deep_embedding.tex
index 171d981..bd3b59a 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:classy_deep_embedding}{Deep embedding with class}%
+\chapter{Deep embedding with class}%
+\label{chp:classy_deep_embedding}
 
 \begin{chapterabstract}
        The two flavours of DSL embedding are shallow and deep embedding.
@@ -21,7 +22,7 @@
        Additionally, little type-level trickery or complicated boilerplate code is required to achieve this.
 \end{chapterabstract}
 
-\section{Introduction}%
+\section{Introduction}
 The two flavours of DSL embedding are deep and shallow embedding~\citep{boulton_experience_1992}.
 In functional programming languages, shallow embedding models language constructs as functions in the host language.
 As a result, adding new language constructs---extra functions---is easy.
@@ -54,8 +55,7 @@ Haskell~\citep{peyton_jones_haskell_2003} program using some minor extensions pr
 \footnotetext{Lubbers, M. (2021): Literate Haskell/lhs2\TeX{} source code of the paper ``Deep Embedding
 with Class'': TFP 2022.\ DANS.\ \url{https://doi.org/10.5281/zenodo.5081386}.}
 
-\section{Deep embedding}%
-
+\section{Deep embedding}
 Pick a DSL, any DSL, pick the language of literal integers and addition.
 In deep embedding, terms in the language are represented by data in the host language.
 Hence, defining the constructs is as simple as creating the following algebraic data type\footnote{All data types and functions are subscripted to indicate the evolution.}.
@@ -98,8 +98,7 @@ Extending the DSL with language constructs exposes the Achilles' heel of deep em
 Adding a case to the data type means that all semantics functions have become partial and need to be updated to be able to handle this new case.
 This does not seem like an insurmountable problem, but it does pose a problem if either the functions or the data type itself are written by others or are contained in a closed library.
 
-\section{Shallow embedding}%
-
+\section{Shallow embedding}
 Conversely, let us see how this would be done in shallow embedding.
 First, the data type is represented by functions in the host language with embedded semantics.
 Therefore, the evaluators for literals and addition both become a function in the host language as follows.
@@ -143,7 +142,7 @@ Semantics become data types\footnotemark{} implementing these type classes, resu
        In this case \haskelllhstexinline{newtype}s are used instead of regular \haskelllhstexinline{data} declarations.
        A \haskelllhstexinline{newtype} is a special data type with a single constructor containing a single value only to which it is isomorphic.
        It allows the programmer to define separate class instances that the instances of the isomorphic type without any overhead.
-       During compilation the constructor is completely removed~\cite[Sec.~4.2.3]{peyton_jones_haskell_2003}.
+       During compilation the constructor is completely removed~\citep[Sec.~4.2.3]{peyton_jones_haskell_2003}.
 }
 
 \begin{lstHaskellLhstex}
@@ -220,7 +219,7 @@ It is only possible to create an expression with a subtraction on the top level.
 The recursive knot is left untied and as a result, \haskelllhstexinline{Sub_1} can never be reached from an \haskelllhstexinline{Expr_1}.
 
 Luckily, we can reconnect them by adding a special constructor to the \haskelllhstexinline{Expr_1} data type for housing extensions.
-It contains an existentially quantified~\citep{mitchell_abstract_1988} type with type class constraints~\citep{laufer_combining_1994,laufer_type_1996} for all semantics type classes~\cite[Chp.~6.4.6]{ghc_team_ghc_2021} to allow it to house not just subtraction but any future extension.
+It contains an existentially quantified~\citep{mitchell_abstract_1988} type with type class constraints~\citep{laufer_combining_1994,laufer_type_1996} for all semantics type classes~\citep[Chp.~6.4.6]{ghc_team_ghc_2021} to allow it to house not just subtraction but any future extension.
 
 \begin{lstHaskellLhstex}
 data Expr_2 =                      Lit_2 Int
@@ -247,7 +246,7 @@ sub_2 e1 e2 = Ext_2 (Sub_2 e1 e2)
 
 In our example this means that the programmer can write\footnotemark{}:
 \footnotetext{%
-       Backticks are used to use functions or constructors in an infix fashion~\cite[Sec.~4.3.3]{peyton_jones_haskell_2003}.
+       Backticks are used to use functions or constructors in an infix fashion~\citep[Sec.~4.3.3]{peyton_jones_haskell_2003}.
 }
 \begin{lstHaskellLhstex}
 e2 :: Expr_2
@@ -370,8 +369,7 @@ instance HasPrint_3 d => Print_3 (Sub_3 d) where
     print_3 (Sub_3 e1 e2) = "(" ++ print_3 e1 ++ "-" ++ print_3 e2 ++ ")"
 \end{lstHaskellLhstex}
 
-\section{Transformation semantics}%
-
+\section{Transformation semantics}
 Most semantics convert a term to some final representation and can be expressed just by functions on the cases.
 However, the implementation of semantics such as transformation or optimisation may benefit from a so-called intentional analysis of the abstract syntax tree.
 In shallow embedding, the implementation for these types of semantics is difficult because there is no tangible abstract syntax tree.
@@ -424,8 +422,7 @@ When a literal zero is matched as the right-hand side of a subtraction, the left
 However, the type signature of the function dictates that it should be of type \haskelllhstexinline{Sub_3}.
 To overcome this problem we add a convolution constructor.
 
-\subsection{Convolution}%
-
+\subsection{Convolution}
 Adding a loopback case or convolution constructor to \haskelllhstexinline{Sub_3} allows the removal of the \haskelllhstexinline{Sub_3} constructor while remaining the \haskelllhstexinline{Sub_3} type.
 It should be noted that a loopback case is \emph{only} required if the transformation actually removes tags.
 This changes the \haskelllhstexinline{Sub_3} data type as follows.
@@ -449,8 +446,7 @@ instance HasOpt_4 d => Opt_4 (Sub_4 d) where
     opt_4 (SubLoop_4 e) =  SubLoop_4 (opt_4 e)
 \end{lstHaskellLhstex}
 
-\subsection{Pattern matching}%
-
+\subsection{Pattern matching}
 Pattern matching within datatypes and from an extension to the main data type works out of the box.
 Cross-extensional pattern matching on the other hand---matching on a particular extension---is something that requires a bit of extra care.
 Take for example negation propagation and double negation elimination.
@@ -543,10 +539,13 @@ e3 :: (Typeable d, GDict (d (Neg_4 d)), GDict (d (Sub_4 d))) => Expr_4 d
 e3 = neg_4 (Lit_4 42 `sub_4` Lit_4 38) `Add_4` Lit_4 1
 \end{lstHaskellLhstex}
 
+\section{Chaining (reprise)}\label{sec:classy_reprise}
+\todo{\ldots}
+
 \section{Generalised algebraic data types}%
 Generalised algebraic data types (GADTs) are enriched data types that allow the type instantiation of the constructor to be explicitly defined~\citep{cheney_first-class_2003,hinze_fun_2003}.
 Leveraging GADTs, deeply embedded DSLs can be made statically type safe even when different value types are supported.
-Even when GADTs are not supported natively in the language, they can be simulated using embedding-projection pairs or equivalence types~\cite[Sec.~2.2]{cheney_lightweight_2002}.
+Even when GADTs are not supported natively in the language, they can be simulated using embedding-projection pairs or equivalence types~\citep[Sec.~2.2]{cheney_lightweight_2002}.
 Where some solutions to the expression problem do not easily generalise to GADTs (see \cref{sec:cde:related}), classy deep embedding does.
 Generalising the data structure of our DSL is fairly straightforward and to spice things up a bit, we add an equality and boolean not language construct.
 To make the existing DSL constructs more general, we relax the types of those constructors.
@@ -596,7 +595,7 @@ class Opt_g   v where
 
 Now that the shape of the type classes has changed, the dictionary data types and the type classes need to be adapted as well.
 The introduced type variable \haskelllhstexinline{a} is not an argument to the type class, so it should not be an argument to the dictionary data type.
-To represent this type class function, a rank-2 polymorphic function is needed~\cite[Chp.~6.4.15]{ghc_team_ghc_2021}\citep{odersky_putting_1996}.
+To represent this type class function, a rank-2 polymorphic function is needed~\citep[Chp.~6.4.15]{ghc_team_ghc_2021}\citep{odersky_putting_1996}.
 Concretely, for the evaluatior this results in the following definitions:
 
 \begin{lstHaskellLhstex}
@@ -681,7 +680,6 @@ This paper differs from those approaches in the sense that it does not require a
 This research is partly funded by the Royal Netherlands Navy.
 Furthermore, I would like to thank Pieter and Rinus for the fruitful discussions, Ralf for inspiring me to write a functional pearl, and the anonymous reviewers for their valuable and honest comments.
 
-%\appendix
 \begin{subappendices}
 \section{Data types and definitions}%
 \label{sec:cde:appendix}
similarity index 97%
rename from domain-specific_languages/dsl_techniques.tex
rename to dsl/dsl_techniques.tex
index 7ca965f..7791c82 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:dsl_embedding_techniques}{DSL embedding techniques}%
+\chapter{DSL embedding techniques}%
+\label{chp:dsl_embedding_techniques}%
 An \gls{EDSL} is a language embedded in a host language created for a specific domain\todo{citation needed?}.
 \glspl{EDSL} can have one or more backends or views.
 Commonly used views are pretty printing, compiling, simulating, verifying and proving the program.
@@ -100,7 +101,7 @@ If a language construct is added, no compile time guarantee can be given that al
        | E.e: Eq    (Expr e)    (Expr e)    -> Expr Bool & == e
 \end{lstClean}
 
-\subsection{Shallow embedding}
+\section{Shallow embedding}
 In a shallowly \gls{EDSL} all language constructs are expressed as functions in the host language.
 An evaluator view for the example language then can be implemented as the code shown in Definition~\ref{lst:exshallow}.
 Note that much of the internals of the language can be hidden using monads.
@@ -131,13 +132,10 @@ It is nearly impossible to add views to a shallowly embedded language.
 The only way of achieving this is by reimplementing all functions so that they run all backends at the same time.
 This will mean that every component will have to implement all views rendering it slow for multiple views and complex to implement.
 
-\subsection{Generalised algebraic data types}
-
-\section{Shallow embedding}
-
 \subsection{Tagless-final embedding}\label{ssec:tagless}
 
 \section{Comparison}
+\todo{cite compositional DSLs}
 
 \input{subfilepostamble}
 \end{document}
similarity index 99%
rename from domain-specific_languages/first-class_datatypes.tex
rename to dsl/first-class_datatypes.tex
index b579445..2f3464c 100644 (file)
@@ -118,7 +118,7 @@ First a data type representing the semantics is defined. In this case, the print
 \footnotetext{%
        In this case a \haskellinline{newtype} is used instead of regular \haskellinline{data} declarations.
        \haskellinline{newtype}s are special data types only consisting a single constructor with one field to which the type is isomorphic.
-       During compilation the constructor is completely removed resulting in no overhead~\cite[Sec.~4.2.3]{peyton_jones_haskell_2003}.
+       During compilation the constructor is completely removed resulting in no overhead~\citep[Sec.~4.2.3]{peyton_jones_haskell_2003}.
 }
 Since the language is typed, the printer data type has to have a type variable but it is only used during typing---i.e.\ a phantom type~\citep{leijen_domain_2000}:
 
@@ -262,7 +262,7 @@ Metaprogramming is a special flavour of programming where programs have the abil
 There are several techniques to facilitate metaprogramming, moreover it has been around for many years now~\citep{lilis_survey_2019}.
 Even though it has been around for many years, it is considered complex~\citep{sheard_accomplishments_2001}.
 
-\gls{TH} is GHC's de facto metaprogramming system, implemented as a compiler extension together with a library~\citep{sheard_template_2002}\cite[Sec.~6.13.1]{ghc_team_ghc_2021}.
+\gls{TH} is GHC's de facto metaprogramming system, implemented as a compiler extension together with a library~\citep{sheard_template_2002}\citep[Sec.~6.13.1]{ghc_team_ghc_2021}.
 Readers already familiar with \gls{TH} can safely skip this section.
 
 \gls{TH} adds four main concepts to the language, na\-me\-ly AST data types, splicing, quasiquotation and reification.
@@ -711,7 +711,7 @@ bin = QuasiQuoter { quoteExp = parseBin }
 Custom quasiquoters allow the \gls{DSL} user to enter fragments verbatim, bypassing the syntax of the host language.
 Pattern matching in general is not suitable for a custom quasiquoter because it does not really fit in one of the four syntactic categories for which custom quasiquoter support is available.
 However, a concrete use of pattern matching, interesting enough to be beneficial, but simple enough for a demonstration is the \emph{simple case expression}, a case expression that does not contain nested patterns and is always exhaustive.
-They correspond to a multi-way conditional expressions and can thus be converted to \gls{DSL} constructs straightforwardly~\cite[Chp.~4.4]{peyton_jones_implementation_1987}.
+They correspond to a multi-way conditional expressions and can thus be converted to \gls{DSL} constructs straightforwardly~\citep[Chp.~4.4]{peyton_jones_implementation_1987}.
 
 In contrast to the binary literal quasiquoter example, we do not create the parser by hand.
 The parser combinator library \emph{parsec} is used instead to ease the creation of the parser~\citep{leijen_parsec_2001}.
@@ -796,9 +796,9 @@ In generic programming, types are represented as sums of products and using this
 
 For example, Rhiger showed a method for expressing statically typed pattern matching using typed higher-order functions~\citep{rhiger_type-safe_2009}.
 If not the host language but the \gls{DSL} contains higher order functions, the same technique could be applied to port pattern matching to \glspl{DSL} though using an explicit sums of products representation.
-Atkey et al.\ describe embedding pattern matching in a \gls{DSL} by giving patterns an explicit representation in the \gls{DSL} by using pairs, sums and injections~\cite[Section~3.3]{atkey_unembedding_2009}.
+Atkey et al.\ describe embedding pattern matching in a \gls{DSL} by giving patterns an explicit representation in the \gls{DSL} by using pairs, sums and injections~\citep[Sec.~3.3]{atkey_unembedding_2009}.
 
-McDonell et al.\ extends on this idea, resulting in a very similar but different solution to ours~\citep{mcdonell_embedded_2021}.
+McDonell et al.\ extends on this idea, resulting in a very similar but different solution to ours~\citep{mcdonell_embedded_2022}.
 They used the technique that Atkey et al.\ showed and applied it to deep embedding using the concrete syntax of the host language.
 The scaffolding---e.g.\ generating the pairs, sums and injections---for embedding is automated using generics but the required pattern synonyms are generated using \gls{TH}.
 The key difference to our approach is that we specialise the implementation for each of the backends instead of providing a general implementation of data type handling operations.
similarity index 100%
rename from frontmatter/by.eps
rename to front/by.eps
similarity index 100%
rename from frontmatter/cc.eps
rename to front/cc.eps
similarity index 100%
rename from frontmatter/motto.tex
rename to front/motto.tex
similarity index 100%
rename from frontmatter/nd.eps
rename to front/nd.eps
similarity index 87%
rename from frontmatter/titlepage.tex
rename to front/titlepage.tex
index c5011d5..91dac40 100644 (file)
        
        {
                \setlength{\parindent}{0cm}%
-               Printed by Drukkerij\\
-
-               Typeset using \LaTeX\\
-
-               ISBN:\ 111-11-11111-11-1\\ % chktex 8
-
-               Copyright \copyright{} Mart Lubbers, 2023\\
-
-               \href{https://martlubbers.net}{martlubbers.net}\\
-
+               Printed by Drukkerij\\[\baselineskip]
+               Typeset using \LaTeX\\[\baselineskip]
+               ISBN:\ 111{-}11{-}11111{-}11{-}1\\[\baselineskip]
+               Copyright \copyright{} Mart Lubbers, 2023\\[\baselineskip]
+               \href{https://martlubbers.net}{martlubbers.net}\\[\baselineskip]
                This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License.
-               To view a copy of this license, visit \url{http://creativecommons.org/licenses/by-nd/4.0/} or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.\\
-
+               To view a copy of this license, visit \url{http://creativecommons.org/licenses/by-nd/4.0/} or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.\\[\baselineskip]
                \includegraphics[scale=.5]{cc}
                \includegraphics[scale=.5]{by}
                \includegraphics[scale=.5]{nd}
index f751d78..ff4c8a3 100644 (file)
@@ -1,9 +1,11 @@
 % Acronyms
+\newacronym{3COWS}{3COWS}{The three ``CO'' (Composability, Comprehensibility, Correctness) winter school}
 \newacronym{ADC}{ADC}{analog-to-digital converter}
 \newacronym{ADT}{ADT}{algebraic data type}
 \newacronym{API}{API}{application programming interface}
 \newacronym{ARDSL}{ARDSL}{\gls{ARDUINO} \acrshort{DSL}}
 \newacronym{BLE}{BLE}{Bluetooth low energy}
+\newacronym{CEFP}{CEFP}{central European summer school of functional programming}
 \newacronym{CRS}{CRS}{\gls{CLEAN} Raspberry Pi system}
 \newacronym{CRTS}{CRTS}{\gls{CLEAN} Raspberry Pi temperature sensor}
 \newacronym{CWS}{CWS}{\gls{CLEAN} wemos system}
        name=iTask,
        description={is a \acrshort{TOP} \acrshort{EDSL} for creating distributed multi-user collaborative web applications},
 }
+\newglossaryentry{TOPHAT}{%
+       name=TopHat,
+       description={is a \acrshort{TOP} language designed to formally capture the essence of \gls{TOP}}.
+}
 \newglossaryentry{CLEAN}{%
        name=Clean,
        description={Clean \acrlong{LEAN}, a pure lazy functional programming language based on graph rewriting}
diff --git a/intro/hyponymy_of_dsls.tex b/intro/hyponymy_of_dsls.tex
new file mode 100644 (file)
index 0000000..ce6ceb5
--- /dev/null
@@ -0,0 +1,15 @@
+\documentclass[tikz]{standalone}
+\usetikzlibrary{positioning}
+\begin{document}
+\begin{tikzpicture}[nodes={draw,minimum width=7.5em},node distance=1.5em]
+       \node (dsl)  {domain-specific language};
+       \node (sta) [below=of dsl,xshift=-3.75em] {standalone};
+       \node (emb) [right=of sta] {embedded};
+       \node (het) [below=of emb,xshift=-3.75em] {heterogeneous};
+       \node (hom) [right=of het] {homogeneous};
+       \draw [->] (dsl) -- (sta);
+       \draw [->] (dsl) -- (emb);
+       \draw [->] (emb) -- (het);
+       \draw [->] (emb) -- (hom);
+\end{tikzpicture}
+\end{document}
similarity index 80%
rename from introduction/introduction.tex
rename to intro/introduction.tex
index 7441014..87aeee6 100644 (file)
@@ -4,7 +4,8 @@
 \ifSubfilesClassLoaded{
        \pagenumbering{arabic}
 }{}
-\mychapter{chp:introduction}{Introduction}
+\chapter{Introduction}%
+\label{chp:introduction}
 %\setlength{\epigraphwidth}{.5\textwidth}%
 %\epigraphhead[30]{
 %      A \textbf{rhapsody} in music is a one-movement work that is episodic yet integrated, free-flowing in structure, featuring a range of highly contrasted moods, colour, and tonality. An air of spontaneous inspiration and a sense of improvisation make it freer in form than a set of variations.
 %      Wikipedia~\citep{wikipedia_contributors_rhapsody_2022}
 %}%
 The sheer number of connected devices around us is increasing exponentially.
-First and foremost, these devices are driven by software.
+All these devices are equipped with processors, sensors, actuators, communication interfaces and much more.
+They 
+The one thing they all have in common
+All these connected devices are driven by software and communicate with eachother, sense and interact with the world.
 This thesis is about \ldots
 \todo[inline]{introduction}
 
 \section{Internet of Things}
 \todo[inline]{add more citations and rewrite to make modern}
 The \gls{IOT} is growing rapidly and it is changing the way people and machines interact with the world.
-While the term \gls{IOT} briefly gained interest around 1999 to describe the communication of \gls{RFID} devices~\todo{cite}, it probably already popped up halfway the eigthies in a speech by Peter T. Lewis~\citep{peter_t_lewis_speech_1985}.
+While the term \gls{IOT} briefly gained interest around 1999 to describe the communication of \gls{RFID} devices~\citep{ashton_internet_1999,ashton_that_2009}, it probably already popped up halfway the eigthies in a speech by \citet{peter_t_lewis_speech_1985}:
 
 \begin{quote}
-       The \acrlong{IOT}, or \acrshort{IOT}, is the integration of people, processes and technology with connectable devices and sensors to enable remote monitoring, status, manipulation and evaluation of trends of such devices.
+       \emph{The \acrlong{IOT}, or \acrshort{IOT}, is the integration of people, processes and technology with connectable devices and sensors to enable remote monitoring, status, manipulation and evaluation of trends of such devices.}
 \end{quote}
 
 CISCO states that the \gls{IOT} only started when there where as many connected devices as there were people on the globe, i.e.\ around 2008~\citep{evans_internet_2011}.
@@ -53,26 +57,23 @@ The number of tiers heavily depends on the complexity of the model but for the i
                A \gls{SN} is a collection of sensors connected by a mesh network or central hub.
 \end{description}
 
-While the number of devices seems to be growing exponentially fast, programming \gls{IOT} systems remains difficult as there is a lot of semantic friction~\citep{ireland_classification_2009}.
-
 The devices are a large heterogeneous collection of different platforms, protocols and languages resulting in impedance problems or semantic friction between layers~\citep{ireland_classification_2009}.
-
-Additionaly, the perception layer often is a heterogeneous collections of microcontrollers as well, each having their own peculiarities, language of choice and hardware interfaces.
+Furthermore, the perception layer often is a heterogeneous collections of microcontrollers as well, each having their own peculiarities, language of choice and hardware interfaces.
 The hardware needs to be cheap, small-scale and energy efficient.
 As a result, the \glspl{MCU} used to power these devices do not have a lot of computational power, a soup\c{c}on of memory, and little communication bandwidth.
 Typically the devices do not run a full fledged \gls{OS} but a compiled firmware.
 This firmware is often written in an imperative language that needs to be flashed to the program memory.
-It is possible to dynamically send the program to the program memory using \gls{OTA} programming~\citep{baccelli_scripting_2018,baccelli_reprogramming_2018}.
 Program memory typically is flash based and only lasts a couple of thousand writes before it wears out.
 While devices are getting a bit faster, smaller, and cheaper, they keep these properties to an extent.
 The properties of the device greatly reduce the flexibility for dynamic systems where tasks are created on the fly, executed on demand and require parallel execution.
+\todo{\gls{OTA} benoemen?}
 These problems can be mitigated by dynamically sending code to be interpreted to the \gls{MCU}.
 With interpretation, a specialized interpreter is flashed in the program memory once that receives the program code to execute at runtime.
 
 %weiser_computer_1991
 \section{Domain-specific languages}
 % General
-Programming languages can be divided up into two categories: \glspl{DSL} and \glspl{GPL}~\citep{fowler_domain_2010}.
+Programming languages can be divided up into two categories: \glspl{DSL}\footnote{Historically this has been called DSEL as well.} and \glspl{GPL}~\citep{fowler_domain_2010}.
 Where \glspl{GPL} are not made with a demarcated area in mind, \glspl{DSL} are tailor-made for a specific domain.
 Writing idiomatic domain-specific code in an \gls{DSL} is easy but this may come at the cost of the \gls{DSL} being less expressive to an extent that it may not even be Turing complete.
 \Glspl{DSL} come in two main flavours: standalone and embedded\footnote{Also called external and internal respectively.} of which \glspl{EDSL} can again be classified into heterogeneous and homogeneous languages (see \cref{fig:hyponymy_of_dsls} for this hyponymy).
@@ -80,39 +81,42 @@ Writing idiomatic domain-specific code in an \gls{DSL} is easy but this may come
 \begin{figure}[ht]
        \centering
        \includestandalone{hyponymy_of_dsls}
-       \caption{Hyponymy of \glspl{DSL} (adapted from~\cite[pg.\ 2]{mernik_extensible_2013})}%
+       \caption{Hyponymy of \glspl{DSL} (adapted from \cite[pg.\ 2]{mernik_extensible_2013})}%
        \label{fig:hyponymy_of_dsls}
 \end{figure}
 
-\glspl{DSL} where historically created as standalone languages which means all the machinery is developed solely for the language.
+\subsection{Standalone and embedded}
+\glspl{DSL} where historically created as standalone languages, meaning all the machinery is developed solely for the language.
 The advantage of this approach is that the language designer is free to define the syntax and type system of the language as they wish, not being restricted by any constraint.
 Unfortunately it also means that they need to develop a compiler or interpreter for the language to be usable making standalone \glspl{DSL} costly to create.
 Examples of standalone \glspl{DSL} are regular expressions, make, yacc, XML, SQL, \etc.
 
-A radically different approach is embeddding the \gls{DSL} in a host language, i.e.\ \glspl{EDSL}~\citep{hudak_modular_1998}.
+A dichotomous approach is embeddding the \gls{DSL} in a host language, i.e.\ \glspl{EDSL}~\citep{hudak_modular_1998}.
 By defining the language as constructs in the host language, much of the machinery is inherited and the cost of creating embedded languages is very low.
+There is more linguistic reuse~\cite{krishnamurthi_linguistic_2001}.
 There are however two sides to the this coin.
 If the syntax of the host language is not very flexible, the syntax of the \gls{DSL} may become clumsy.
 Furthermore, errors shown to the programmer may be larded with host language errors, making it difficult for a non-expert of the host language to work with the \gls{DSL}.
 
+\subsection{Heterogeneity and homogeneity}
 Tratt applied a notion from metaprogramming~\citep{sheard_accomplishments_2001} to \glspl{EDSL} to define homogeneity and heterogeneity of \glspl{EDSL} as follows~\citep{tratt_domain_2008}:
 \begin{quote}
-       a homogeneous system is one where all the components are specifically designed to work with each other, whereas in heterogeneous systems at least one of the components is largely, or completely, ignorant of the existence of the other parts of the system.
+       \emph{a homogeneous system is one where all the components are specifically designed to work with each other, whereas in heterogeneous systems at least one of the components is largely, or completely, ignorant of the existence of the other parts of the system.}
 \end{quote}
 Homogeneous \glspl{EDSL} are therefore languages that are solely defined as an extension to their host language.
 They often restrict features of the host language to provide a safer interface or capture an idiomatic pattern in the host language for reuse.
 The difference between a library and a homogeneous \glspl{EDSL} is not always clear.
-Examples of homogeneous \glspl{EDSL} are libraries such as ones for \glspl{GUI} creation, LISP's macro system, \etc.
+Examples of homogeneous \glspl{EDSL} are libraries such as ones for sets, \glspl{GUI} creation, LISP's macro system, \etc.
 
 On the other hand, heterogeneous \glspl{EDSL} are languages that are not executed in the host language.
 For example, Elliott et al.\ describe the language Pan, for which the final representation in the host language is a compiler that will, when executed, generate code for a completely different target platform~\citep{elliott_compiling_2003}.
-In fact, \gls{ITASK} and \gls{MTASK} are both heterogeneous \glspl{EDSL}.
+In fact, \gls{ITASK} and \gls{MTASK} are both heterogeneous \glspl{EDSL}\todo{reference next section?}.
 
 \section{Task-oriented programming}
 \Gls{TOP} is a declarative programming paradigm designed to model interactive systems~\citep{plasmeijer_task-oriented_2012}.
 Instead of dividing problems into layers or tiers, as is done in \gls{IOT} architectures as well, it deals with separation of concerns in a novel way.
 From the data types, utilising various \emph{type-parametrised} concepts, all other aspects are handled (see \cref{fig:tosd}).
-This approach to software development is also called \gls{TOSD}~\citep{wang_maintaining_2018}.
+This approach to software development is called \gls{TOSD}~\citep{wang_maintaining_2018}.
 
 \begin{figure}[ht]
        \centering
@@ -131,78 +135,72 @@ This approach to software development is also called \gls{TOSD}~\citep{wang_main
 \end{figure}
 
 \begin{description}
-       \item[Presentation layer: UI]
+       \item[Presentation layer: \gls{UI}]
                The \gls{UI} of the system is automatically generated from the representation of the type.
-               For instance, \gls{TOP} languages implemented in an \gls{FP} language often use generic programming or template metaprogramming to automatically achieve this.
-               \Gls{TOP} languages embedded in imperative programming languages may use introspection\todo{Do I want this sentence here?}.
-               Even though the \gls{UI} is generated from the structure of the datatypes, in many practical \gls{TOP} systems it can be tweaked afterwards to suit the specific needs of the application.
-       \item[Business layer: Tasks]
+%              For instance, \gls{TOP} languages implemented in an \gls{FP} language often use generic programming or template metaprogramming to automatically achieve this.
+%              \Gls{TOP} languages embedded in imperative programming languages may use introspection\todo{Do I want this sentence here?}.
+               Even though the \gls{UI} is generated from the structure of the datatypes, in practical \gls{TOP} systems it can be tweaked afterwards to suit the specific needs of the application.
+       \item[Business layer: tasks]
                A task is an abstract representation of a piece of work that needs to be done.
                It provides an intuitive abstraction over work in the real world.
                Just as with real-life tasks and workflow, tasks can be combined in various ways such as in parallel or in sequence.
-               Furthermore, tasks are observable which means it is possible to observe a --- partial --- result during execution and act upon it by for example starting new tasks.
+               Furthermore, a task is observable which means it is possible to observe a---partial---result during execution and act upon it by for example starting new tasks.
                Examples of tasks are filling in a form, sending an email, reading a sensor or even doing a physical task.
        \item[Resource access: \glspl{SDS}]
                Tasks can communicate using task values but this imposes a problem in many collaboration patterns where tasks that are not necessarily related need to share data.
-               Tasks can also share data using \glspl{SDS}.
-               \Glspl{SDS} are an abstraction over any data.
+               Tasks can also share data using \glspl{SDS}, an abstraction over any data.
                An \gls{SDS} can represent typed data stored in a file, a chunk of memory, a database \etc.
                \Glspl{SDS} can also represent external impure data such as the time, random numbers or sensory data.
                Similar to tasks, transformation and combination of \glspl{SDS} is possible.
-       \item[\Gls{UOD}: PL]
+       \item[\Gls{UOD}: programming language]
                The \gls{UOD} from the business layer is explicitly and separately modelled by the relations that exist in the functions of the host language.
-               \gls{TOP} languages are usually embedded in \gls{FP} languages but this not necessarily the case.
-               Some host languages also provide the implementations for the tasks and \glspl{SDS}.
-               \todo{dit moet beter}
 \end{description}
 
+The concept of \gls{TOP} originated from the \gls{ITASK} framework, a declarative workflow language for defining multi-user distributed web applications implemented as an \gls{EDSL} in the lazy pure functional programming language \gls{CLEAN}~\citep{plasmeijer_itasks:_2007,plasmeijer_task-oriented_2012}.
+While \gls{ITASK} conceived \gls{TOP}, it is not the only \gls{TOP} language.
+\Gls{TOPHAT} is a fully formally specified \gls{TOP} language designed to capture the essence of \gls{TOP} formally~\citep{steenvoorden_tophat_2019}.
+\citet{piers_task-oriented_2016} created \textmu{}Task, a \gls{TOP} language for specifying non-interruptible embedded systems implemented as an \gls{EDSL} in \gls{HASKELL}.
+\citet{van_gemert_task_2022} created LTasks, a \gls{TOP} language for interactive terminal applications implemented in LUA, a dynamically typed imperative language.
+\citet{lijnse_toppyt_2022} created Toppyt, a \gls{TOP} language based on \gls{ITASK}, implemented in \gls{PYTHON}, but designed to be simpler and smaller.
+Finally there is \gls{MTASK}, \gls{TOP} language designed for defining workflow for \gls{IOT} devices~\cite{koopman_task-based_2018}.
+It is written in \gls{CLEAN} as an \gls{EDSL} fully integrated with \gls{ITASK} and allows the programmer to define all layers of an \gls{IOT} system from a single source.
+
 \section{Outline}
 \todo[inline]{uitbreiden}
-%\epigraph{%
-%      \textbf{rhapsody} /\textipa{['r\ae{}ps@di]}/ \emph{noun} (pl.\ \textbf{-ies}) a piece of music that is full of feeling and is not regular in form: Liszt's Hungarian Rhapsodies.
-%}{%
-%      Oxford Advanced Learners Dictionary~\citep{margaret_deuter_rhapsody_2015}.
-%}
-This thesis is structured as a purely functional rhapsody.
 On Wikipedia, a rhapsody is defined as follows~\citep{wikipedia_contributors_rhapsody_2022}:
 \begin{quote}
-       A \textbf{rhapsody} in music is a one-movement work that is episodic yet integrated, free-flowing in structure, featuring a range of highly contrasted moods, colour, and tonality. An air of spontaneous inspiration and a sense of improvisation make it freer in form than a set of variations.
+       \emph{A \textbf{rhapsody} in music is a one-movement work that is episodic yet integrated, free-flowing in structure, featuring a range of highly contrasted moods, colour, and tonality. An air of spontaneous inspiration and a sense of improvisation make it freer in form than a set of variations.}
 \end{quote}
 
-This thesis follows the tradition and consists of three movements that are episodic yet integrated.
+This thesis follows the tradition and consists of three movements that are episodic yet integrated, a purely functional rhapsody.
 \Cref{prt:dsl} is about \gls{EDSL} techniques, \cref{prt:top} elaborates on \gls{TOP} for the \gls{IOT} and \cref{prt:tvt} compares traditional tiered \gls{IOT} architectures to a tierless architectures such as \gls{TOP}.
 The movements are readable independently if the reader is familiarised with the background material provided in \cref{chp:introduction}.
 The thesis wraps up with \cref{chp:conclusion} that provides a conclusion and an outlook on future work.
 
-\subsection{\Cref{prt:dsl}: Domain-specific languages}
+\subsection*{\nameref{prt:dsl}}
 This movement is a cumulative---paper-based---movement that focusses on techniques for embedding \glspl{DSL} in functional programming lanugages.
 After reading the first chapter, subsequent chapters in this movement are readable as independently.
 
-\subsubsection{\Cref{chp:dsl_embedding_techniques}}
+\subsubsection*{\fullref{chp:dsl_embedding_techniques}}
 This chapter shows the basic \gls{DSL} embedding techniques and compares the properties of several embedding methods.
-This chapter is not based on a paper and written as a background for the subsequent chapters in the movement.
+This chapter is not based on a paper and written as a extra background material for the subsequent chapters in the movement.
 
-\subsubsection{\Cref{chp:classy_deep_embedding}} 
+\subsubsection*{\fullref{chp:classy_deep_embedding}} 
 This chapter is based on the paper: \emph{Deep Embedding with Class}~\todo{cite when published}.
 
 During a Master's thesis supervision~\citep{amazonas_cabral_de_andrade_developing_2018}, focussing on an early version of \gls{MTASK}, a seed was planted for a novel deep embedding technique for \glspl{DSL} where the resulting language is extendible both in constructs and in interpretation using type classes and existential data types.
 Slowly the ideas organically grew to form the technique shown in the paper.
 
 The research from this paper and writing the paper was solely performed by me.
+\Cref{sec:classy_reprise} was added after publication and contains a (yet) unpublished extension of the embedding technique.
 
-\subsubsection{\Cref{chp:first-class_datatypes}} shows how to inherit data types in \glspl{EDSL} using metaprogramming.
+\subsubsection*{\fullref{chp:first-class_datatypes}}
 This chapter is based on the paper: \emph{First-Class Data Types in Shallow Embedded Domain-Specific Languages using Metaprogramming}~\todo{cite when accepted}.
+It shows how to inherit data types in \glspl{EDSL} using metaprogramming.
 
 The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer in which we discussed and refined the ideas.
-%
-%\subsubsection{\Cref{chp:strongly-typed_multi-view_stack-based_computations}} shows how to use advanced \gls{DSL} techniques to embed type safe stack-based computations in a host language.
-%This chapter is based on the paper: \emph{Strongly-Typed Multi-View Stack-Based Computations}~\todo{cite when accepted}.
-%\todo{Zal ik dit paper wel opnemen? Aangezien Pieter het grotendeels gedaan heeft?}
-%
-%I supported Pieter Koopman in performing the research in this paper by writing some of the software.
-%The paper was mostly written by Pieter Koopman\todo{probably will be}.
-
-\subsection{\Cref{prt:top}: Task-oriented \texorpdfstring{\acrlong{IOT}}{internet of things} programming }
+
+\subsection*{\nameref{prt:top}}
 This part is a monograph focussing on \glspl{TOP} for the \gls{IOT}.
 Therefore, the chapters depend on eachother and are best read in order.
 The monograph is compiled from the following papers and revised lecture notes.
@@ -281,7 +279,7 @@ The movement is made up out of the following chapters
        \item TOP for IoT beyond microprocessors
 \end{itemize}
 
-\subsection{\Cref{prt:tvt}: Tiered versus tierless programming}
+\subsection*{\nameref{prt:tvt}}
 These chapters focus on comparing traditional tiered architectures to tierless architectures and are based on a single journal paper that extended on a conference paper.
 The conference paper was partly funded by the Radboud-Glasgow Collaboration Fund.
 It does both a qualitative and a quantitative four-way comparison of a smart campus application.
similarity index 100%
rename from introduction/tosd.tex
rename to intro/tosd.tex
index fb90016..f217c2f 100644 (file)
@@ -4,5 +4,5 @@
                D0,D1,D2,D3,D4,D5,D6,D7,D7,D8,D9,D10,D11,D12,D13,A0,A1,A2,A3,A4,A5,A6,A7,%
                pinMode,digitalWrite,digitalRead,delay,millis,%
        },
-       basewidth=.6em,
+       columns=fullflexible,
 }
index 43ed0f4..0abc301 100644 (file)
@@ -1,57 +1,5 @@
-\lstdefinestyle{haskell}{%
-       language=Haskell,
-       deletekeywords={%
-               Applicative,%
-               Bool,%
-               Char,%
-               Double,%
-               Either,%
-               Eq,%
-               False,%
-               Float,%
-               Fractional,%
-               Functor,%
-               Int,%
-               Integer,%
-               Just,%
-               Left,%
-               List,%
-               Maybe,%
-               Monad,%
-               Nothing,%
-               Num,%
-               Right,%
-               Show,%
-               String,%
-               True,%
-               concatMap,%
-               const,%
-               div,%
-               error,%
-               fail,%
-               foldM,%
-               foldl,%
-               foldr,%
-               fst,%
-               id,%
-               length,%
-               map,%
-               mapM,%
-               pred,%
-               print,%
-               product,%
-               sequence,%
-               show,%
-               snd,%
-               sum,%
-               uncurry,%
-               undefined,%
-               unwords,%
-               unzip,%
-               zip,%
-               zipWith,%
-               }
-       morekeywords={forall,Q},
+\lstdefinelanguage[Regular]{Haskell}[]{Haskell}{%
+       keywords={abstype,if,then,else,case,class,data,default,deriving,hiding,if,in,infix,infixl,infixr,import,instance,let,module,newtype,of,qualified,type,where,do,Q},
        literate=%
                {forall}{{$\forall$}}1
                {\_}{{\raisebox{.15ex}{\_}}}1
                {\[|}{{$\llbracket$}}1
                {|\]}{{$\rrbracket$}}1
 }
+\lstdefinelanguage[Lhs2Tex]{Haskell}[Regular]{Haskell}{%
+       moreliterate=%
+               {e1}{{e\textsubscript{1}}}2
+               {e2}{{e\textsubscript{2}}}2
+               {e3}{{e\textsubscript{3}}}2
+               {e1p}{{e\textsubscript{1}\textsuperscript{$\prime$}}}2
+               {e2p}{{e\textsubscript{2}\textsuperscript{$\prime$}}}2
+               {eval_0}{{eval\textsubscript{0}}}5
+               {Eval_0}{{Eval\textsubscript{0}}}5
+               {Expr_0}{{Expr\textsubscript{0}}}5
+               {Lit_0}{{Lit\textsubscript{0}}}4
+               {Add_0}{{Add\textsubscript{0}}}4
+               {Sub_0}{{Sub\textsubscript{0}}}4
+               {Print_0}{{Print\textsubscript{0}}}6
+               {print_0}{{print\textsubscript{0}}}6
+               {Sem_s}{{Sem\textsubscript{s}}}4
+               {lit_s}{{lit\textsubscript{s}}}4
+               {add_s}{{add\textsubscript{s}}}4
+               {sub_s}{{sub\textsubscript{s}}}4
+               {Expr_t}{{Expr\textsubscript{t}}}5
+               {Eval_t}{{Eval\textsubscript{t}}}5
+               {E_t}{{E\textsubscript{t}}}2
+               {Printer_t}{{Printer\textsubscript{t}}}8
+               {P_t}{{P\textsubscript{t}}}2
+               {lit_t}{{lit\textsubscript{t}}}4
+               {add_t}{{add\textsubscript{t}}}4
+               {Sub_t}{{Sub\textsubscript{t}}}4
+               {sub_t}{{sub\textsubscript{t}}}4
+               {eval_1}{{eval\textsubscript{1}}}5
+               {Eval_1}{{Eval\textsubscript{1}}}5
+               {Expr_1}{{Expr\textsubscript{1}}}5
+               {Lit_1}{{Lit\textsubscript{1}}}4
+               {Add_1}{{Add\textsubscript{1}}}4
+               {Sub_1}{{Sub\textsubscript{1}}}4
+               {Print_1}{{Print\textsubscript{1}}}6
+               {print_1}{{print\textsubscript{1}}}6
+               {eval_2}{{eval\textsubscript{2}}}5
+               {Eval_2}{{Eval\textsubscript{2}}}5
+               {Expr_2}{{Expr\textsubscript{2}}}5
+               {Lit_2}{{Lit\textsubscript{2}}}4
+               {Add_2}{{Add\textsubscript{2}}}4
+               {Sub_2}{{Sub\textsubscript{2}}}4
+               {sub_2}{{sub\textsubscript{2}}}4
+               {Ext_2}{{Ext\textsubscript{2}}}4
+               {Print_2}{{Print\textsubscript{2}}}6
+               {print_2}{{print\textsubscript{2}}}6
+               {Semantics_2}{{Semantics\textsubscript{2}}}{10}
+               {eval_3}{{eval\textsubscript{3}}}5
+               {Eval_3}{{Eval\textsubscript{3}}}5
+               {Print_3}{{Print\textsubscript{3}}}6
+               {print_3}{{print\textsubscript{3}}}6
+               {opt_3}{{opt\textsubscript{3}}}4
+               {Opt_3}{{Opt\textsubscript{3}}}4
+               {HasEval_3}{{HasEval\textsubscript{3}}}8
+               {getEval_3}{{getEval\textsubscript{3}}}8
+               {EvalDict_3}{{EvalDict\textsubscript{3}}}9
+               {HasPrint_3}{{HasPrint\textsubscript{3}}}9
+               {getPrint_3}{{getPrint\textsubscript{3}}}9
+               {PrintDict_3}{{PrintDict\textsubscript{3}}}{10}
+               {HasOpt_3}{{HasOpt\textsubscript{3}}}7
+               {getOpt_3}{{getOpt\textsubscript{3}}}7
+               {OptDict_3}{{OptDict\textsubscript{3}}}8
+               {Expr_3}{{Expr\textsubscript{3}}}5
+               {Lit_3}{{Lit\textsubscript{3}}}4
+               {Add_3}{{Add\textsubscript{3}}}4
+               {Sub_3}{{Sub\textsubscript{3}}}4
+               {sub_3}{{sub\textsubscript{3}}}4
+               {Ext_3}{{Ext\textsubscript{3}}}4
+               {eval_4}{{eval\textsubscript{4}}}5
+               {Eval_4}{{Eval\textsubscript{4}}}5
+               {Print_4}{{Print\textsubscript{4}}}5
+               {print_4}{{print\textsubscript{4}}}5
+               {opt_4}{{opt\textsubscript{4}}}4
+               {Opt_4}{{Opt\textsubscript{4}}}4
+               {HasEval_4}{{HasEval\textsubscript{4}}}8
+               {getEval_4}{{getEval\textsubscript{4}}}8
+               {EvalDict_4}{{EvalDict\textsubscript{4}}}9
+               {HasPrint_4}{{HasPrint\textsubscript{4}}}9
+               {getPrint_4}{{getPrint\textsubscript{4}}}9
+               {PrintDict_4}{{PrintDict\textsubscript{4}}}{10}
+               {HasOpt_4}{{HasOpt\textsubscript{4}}}7
+               {getOpt_4}{{getOpt\textsubscript{4}}}7
+               {OptDict_4}{{OptDict\textsubscript{4}}}8
+               {OptPrintDict_4}{{OptPrintDict\textsubscript{4}}}{14}
+               {OPD_4}{{OPD\textsubscript{4}}}4
+               {Expr_4}{{Expr\textsubscript{4}}}5
+               {Lit_4}{{Lit\textsubscript{4}}}4
+               {Add_4}{{Add\textsubscript{4}}}4
+               {Sub_4}{{Sub\textsubscript{4}}}4
+               {SubLoop_4}{{SubLoop\textsubscript{4}}}8
+               {sub_4}{{sub\textsubscript{4}}}4
+               {Neg_4}{{Neg\textsubscript{4}}}4
+               {NegLoop_4}{{NegLoop\textsubscript{4}}}8
+               {neg_4}{{neg\textsubscript{4}}}4
+               {Ext_4}{{Ext\textsubscript{4}}}4
+               {eval_g}{{eval\textsubscript{g}}}5
+               {Eval_g}{{Eval\textsubscript{g}}}5
+               {Print_g}{{Print\textsubscript{g}}}6
+               {print_g}{{print\textsubscript{g}}}6
+               {opt_g}{{opt\textsubscript{g}}}4
+               {Opt_g}{{Opt\textsubscript{g}}}4
+               {HasEval_g}{{HasEval\textsubscript{g}}}8
+               {getEval_g}{{getEval\textsubscript{g}}}8
+               {EvalDict_g}{{EvalDict\textsubscript{g}}}9
+               {HasPrint_g}{{HasPrint\textsubscript{g}}}9
+               {getPrint_g}{{getPrint\textsubscript{g}}}9
+               {PrintDict_g}{{PrintDict\textsubscript{g}}}{10}
+               {HasOpt_g}{{HasOpt\textsubscript{g}}}7
+               {getOpt_g}{{getOpt\textsubscript{g}}}7
+               {OptDict_g}{{OptDict\textsubscript{g}}}8
+               {OptPrintDict_g}{{OptPrintDict\textsubscript{g}}}{14}
+               {OPD_g}{{OPD\textsubscript{g}}}4
+               {Expr_g}{{Expr\textsubscript{g}}}5
+               {Lit_g}{{Lit\textsubscript{g}}}4
+               {Add_g}{{Add\textsubscript{g}}}4
+               {Sub_g}{{Sub\textsubscript{g}}}4
+               {SubLoop_g}{{SubLoop\textsubscript{g}}}8
+               {sub_g}{{sub\textsubscript{g}}}4
+               {Neg_g}{{Neg\textsubscript{g}}}4
+               {NegLoop_g}{{NegLoop\textsubscript{g}}}8
+               {neg_g}{{neg\textsubscript{g}}}4
+               {NotLoop_g}{{NotLoop\textsubscript{g}}}8
+               {Not_g}{{Not\textsubscript{g}}}4
+               {not_g}{{not\textsubscript{g}}}4
+               {EqLoop_g}{{EqLoop\textsubscript{g}}}7
+               {Eq_g}{{Eq\textsubscript{g}}}3
+               {eq_g}{{eq\textsubscript{g}}}3
+               {Ext_g}{{Ext\textsubscript{g}}}4
+}
diff --git a/lstlanghaskelllhstex.sty b/lstlanghaskelllhstex.sty
deleted file mode 100644 (file)
index 0239d37..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-\lstdefinestyle{haskelllhstex}{%
-       language=Haskell,
-       deletekeywords={%
-               True,False,%
-               Bool,Int,Integer,Float,Double,String,%
-               Maybe,Nothing,Just,%
-               zip,length,Show,show,Num,Eq,print,%
-               error,id},
-       morekeywords={forall},
-       literate=%
-               {forall}{{$\forall$}}1
-               {\_}{{\raisebox{.15ex}{\_}}}1
-               {~}{{\raisebox{-.6ex}{\textasciitilde}}}1
-               {\\}{{$\lambda\:$}}1
-               {->}{{$\shortrightarrow$}}2
-               {<-}{{$\shortleftarrow$}}2
-               {=>}{{$\Rightarrow$}}2
-               {<=}{{$\Leftarrow$}}2
-               {...}{{$\cdots$}}1 %chktex 11
-               {e1}{{e\textsubscript{1}}}2
-               {e2}{{e\textsubscript{2}}}2
-               {e3}{{e\textsubscript{3}}}2
-               {e1p}{{e\textsubscript{1}\textsuperscript{$\prime$}}}2
-               {e2p}{{e\textsubscript{2}\textsuperscript{$\prime$}}}2
-               {eval_0}{{eval\textsubscript{0}}}5
-               {Eval_0}{{Eval\textsubscript{0}}}5
-               {Expr_0}{{Expr\textsubscript{0}}}5
-               {Lit_0}{{Lit\textsubscript{0}}}4
-               {Add_0}{{Add\textsubscript{0}}}4
-               {Sub_0}{{Sub\textsubscript{0}}}4
-               {Print_0}{{Print\textsubscript{0}}}6
-               {print_0}{{print\textsubscript{0}}}6
-               {Sem_s}{{Sem\textsubscript{s}}}4
-               {lit_s}{{lit\textsubscript{s}}}4
-               {add_s}{{add\textsubscript{s}}}4
-               {sub_s}{{sub\textsubscript{s}}}4
-               {Expr_t}{{Expr\textsubscript{t}}}5
-               {Eval_t}{{Eval\textsubscript{t}}}5
-               {E_t}{{E\textsubscript{t}}}2
-               {Printer_t}{{Printer\textsubscript{t}}}8
-               {P_t}{{P\textsubscript{t}}}2
-               {lit_t}{{lit\textsubscript{t}}}4
-               {add_t}{{add\textsubscript{t}}}4
-               {Sub_t}{{Sub\textsubscript{t}}}4
-               {sub_t}{{sub\textsubscript{t}}}4
-               {eval_1}{{eval\textsubscript{1}}}5
-               {Eval_1}{{Eval\textsubscript{1}}}5
-               {Expr_1}{{Expr\textsubscript{1}}}5
-               {Lit_1}{{Lit\textsubscript{1}}}4
-               {Add_1}{{Add\textsubscript{1}}}4
-               {Sub_1}{{Sub\textsubscript{1}}}4
-               {Print_1}{{Print\textsubscript{1}}}6
-               {print_1}{{print\textsubscript{1}}}6
-               {eval_2}{{eval\textsubscript{2}}}5
-               {Eval_2}{{Eval\textsubscript{2}}}5
-               {Expr_2}{{Expr\textsubscript{2}}}5
-               {Lit_2}{{Lit\textsubscript{2}}}4
-               {Add_2}{{Add\textsubscript{2}}}4
-               {Sub_2}{{Sub\textsubscript{2}}}4
-               {sub_2}{{sub\textsubscript{2}}}4
-               {Ext_2}{{Ext\textsubscript{2}}}4
-               {Print_2}{{Print\textsubscript{2}}}6
-               {print_2}{{print\textsubscript{2}}}6
-               {Semantics_2}{{Semantics\textsubscript{2}}}{10}
-               {eval_3}{{eval\textsubscript{3}}}5
-               {Eval_3}{{Eval\textsubscript{3}}}5
-               {Print_3}{{Print\textsubscript{3}}}6
-               {print_3}{{print\textsubscript{3}}}6
-               {opt_3}{{opt\textsubscript{3}}}4
-               {Opt_3}{{Opt\textsubscript{3}}}4
-               {HasEval_3}{{HasEval\textsubscript{3}}}8
-               {getEval_3}{{getEval\textsubscript{3}}}8
-               {EvalDict_3}{{EvalDict\textsubscript{3}}}9
-               {HasPrint_3}{{HasPrint\textsubscript{3}}}9
-               {getPrint_3}{{getPrint\textsubscript{3}}}9
-               {PrintDict_3}{{PrintDict\textsubscript{3}}}{10}
-               {HasOpt_3}{{HasOpt\textsubscript{3}}}7
-               {getOpt_3}{{getOpt\textsubscript{3}}}7
-               {OptDict_3}{{OptDict\textsubscript{3}}}8
-               {Expr_3}{{Expr\textsubscript{3}}}5
-               {Lit_3}{{Lit\textsubscript{3}}}4
-               {Add_3}{{Add\textsubscript{3}}}4
-               {Sub_3}{{Sub\textsubscript{3}}}4
-               {sub_3}{{sub\textsubscript{3}}}4
-               {Ext_3}{{Ext\textsubscript{3}}}4
-               {eval_4}{{eval\textsubscript{4}}}5
-               {Eval_4}{{Eval\textsubscript{4}}}5
-               {Print_4}{{Print\textsubscript{4}}}5
-               {print_4}{{print\textsubscript{4}}}5
-               {opt_4}{{opt\textsubscript{4}}}4
-               {Opt_4}{{Opt\textsubscript{4}}}4
-               {HasEval_4}{{HasEval\textsubscript{4}}}8
-               {getEval_4}{{getEval\textsubscript{4}}}8
-               {EvalDict_4}{{EvalDict\textsubscript{4}}}9
-               {HasPrint_4}{{HasPrint\textsubscript{4}}}9
-               {getPrint_4}{{getPrint\textsubscript{4}}}9
-               {PrintDict_4}{{PrintDict\textsubscript{4}}}{10}
-               {HasOpt_4}{{HasOpt\textsubscript{4}}}7
-               {getOpt_4}{{getOpt\textsubscript{4}}}7
-               {OptDict_4}{{OptDict\textsubscript{4}}}8
-               {OptPrintDict_4}{{OptPrintDict\textsubscript{4}}}{14}
-               {OPD_4}{{OPD\textsubscript{4}}}4
-               {Expr_4}{{Expr\textsubscript{4}}}5
-               {Lit_4}{{Lit\textsubscript{4}}}4
-               {Add_4}{{Add\textsubscript{4}}}4
-               {Sub_4}{{Sub\textsubscript{4}}}4
-               {SubLoop_4}{{SubLoop\textsubscript{4}}}8
-               {sub_4}{{sub\textsubscript{4}}}4
-               {Neg_4}{{Neg\textsubscript{4}}}4
-               {NegLoop_4}{{NegLoop\textsubscript{4}}}8
-               {neg_4}{{neg\textsubscript{4}}}4
-               {Ext_4}{{Ext\textsubscript{4}}}4
-               {eval_g}{{eval\textsubscript{g}}}5
-               {Eval_g}{{Eval\textsubscript{g}}}5
-               {Print_g}{{Print\textsubscript{g}}}6
-               {print_g}{{print\textsubscript{g}}}6
-               {opt_g}{{opt\textsubscript{g}}}4
-               {Opt_g}{{Opt\textsubscript{g}}}4
-               {HasEval_g}{{HasEval\textsubscript{g}}}8
-               {getEval_g}{{getEval\textsubscript{g}}}8
-               {EvalDict_g}{{EvalDict\textsubscript{g}}}9
-               {HasPrint_g}{{HasPrint\textsubscript{g}}}9
-               {getPrint_g}{{getPrint\textsubscript{g}}}9
-               {PrintDict_g}{{PrintDict\textsubscript{g}}}{10}
-               {HasOpt_g}{{HasOpt\textsubscript{g}}}7
-               {getOpt_g}{{getOpt\textsubscript{g}}}7
-               {OptDict_g}{{OptDict\textsubscript{g}}}8
-               {OptPrintDict_g}{{OptPrintDict\textsubscript{g}}}{14}
-               {OPD_g}{{OPD\textsubscript{g}}}4
-               {Expr_g}{{Expr\textsubscript{g}}}5
-               {Lit_g}{{Lit\textsubscript{g}}}4
-               {Add_g}{{Add\textsubscript{g}}}4
-               {Sub_g}{{Sub\textsubscript{g}}}4
-               {SubLoop_g}{{SubLoop\textsubscript{g}}}8
-               {sub_g}{{sub\textsubscript{g}}}4
-               {Neg_g}{{Neg\textsubscript{g}}}4
-               {NegLoop_g}{{NegLoop\textsubscript{g}}}8
-               {neg_g}{{neg\textsubscript{g}}}4
-               {NotLoop_g}{{NotLoop\textsubscript{g}}}8
-               {Not_g}{{Not\textsubscript{g}}}4
-               {not_g}{{not\textsubscript{g}}}4
-               {EqLoop_g}{{EqLoop\textsubscript{g}}}7
-               {Eq_g}{{Eq\textsubscript{g}}}3
-               {eq_g}{{eq\textsubscript{g}}}3
-               {Ext_g}{{Ext\textsubscript{g}}}4
-}
index ba881fd..188e95c 100644 (file)
--- a/other.bib
+++ b/other.bib
@@ -287,6 +287,22 @@ Publisher: Association for Computing Machinery},
        file = {Mitchell and Plotkin - 1988 - Abstract types have existential type.pdf:/home/mrl/.local/share/zotero/storage/QXDE5H7C/Mitchell and Plotkin - 1988 - Abstract types have existential type.pdf:application/pdf},
 }
 
+@inproceedings{steenvoorden_tophat_2019,
+       address = {New York, NY, USA},
+       series = {{PPDP} '19},
+       title = {{TopHat}: {A} {Formal} {Foundation} for {Task}-{Oriented} {Programming}},
+       isbn = {978-1-4503-7249-7},
+       url = {https://doi.org/10.1145/3354166.3354182},
+       doi = {10.1145/3354166.3354182},
+       abstract = {Software that models how people work is omnipresent in today's society. Current languages and frameworks often focus on usability by non-programmers, sacrificing flexibility and high level abstraction. Task-oriented programming (TOP) is a programming paradigm that aims to provide the desired level of abstraction while still being expressive enough to describe real world collaboration. It prescribes a declarative programming style to specify multi-user workflows. Workflows can be higher-order. They communicate through typed values on a local and global level. Such specifications can be turned into interactive applications for different platforms, supporting collaboration during execution. TOP has been around for more than a decade, in the forms of iTasks and mTasks, which are tailored for real-world usability. So far, it has not been given a formalisation which is suitable for formal reasoning.In this paper we give a description of the TOP paradigm and then decompose its rich features into elementary language elements, which makes them suitable for formal treatment. We use the simply typed lambda-calculus, extended with pairs and references, as a base language. On top of this language, we develop TopHat, a language for modular interactive workflows. We describe TopHat by means of a layered semantics. These layers consist of multiple big-step evaluations on expressions, and two labelled transition systems, handling user inputs.With TopHat we prepare a way to formally reason about TOP languages and programs. This approach allows for comparison with other work in the field. We have implemented the semantic rules of TopHat in Haskell, and the task layer on top of the iTasks framework. This shows that our approach is feasible, and lets us demonstrate the concepts by means of illustrative case studies. TOP has been applied in projects with the Dutch coast guard, tax office, and navy. Our work matters because formal program verification is important for mission-critical software, especially for systems with concurrency.},
+       booktitle = {Proceedings of the 21st {International} {Symposium} on {Principles} and {Practice} of {Declarative} {Programming}},
+       publisher = {Association for Computing Machinery},
+       author = {Steenvoorden, Tim and Naus, Nico and Klinik, Markus},
+       year = {2019},
+       note = {event-place: Porto, Portugal},
+       file = {Steenvoorden et al. - 2019 - TopHat A Formal Foundation for Task-Oriented Prog.pdf:/home/mrl/.local/share/zotero/storage/W7HJ5MEF/Steenvoorden et al. - 2019 - TopHat A Formal Foundation for Task-Oriented Prog.pdf:application/pdf},
+}
+
 @inproceedings{yorgey_giving_2012,
        address = {New York, NY, USA},
        series = {{TLDI} '12},
@@ -442,6 +458,16 @@ Publisher: Association for Computing Machinery},
        file = {Barendsen and Smetsers - 1996 - Uniqueness typing for functional languages with gr.pdf:/home/mrl/.local/share/zotero/storage/BPRC6KJK/Barendsen and Smetsers - 1996 - Uniqueness typing for functional languages with gr.pdf:application/pdf},
 }
 
+@inproceedings{lijnse_itasks_2009,
+       title = {{iTasks} 2: {iTasks} for {End}-users},
+       booktitle = {International {Symposium} on {Implementation} and {Application} of {Functional} {Languages}},
+       publisher = {Springer},
+       author = {Lijnse, Bas and Plasmeijer, Rinus},
+       year = {2009},
+       pages = {36--54},
+       file = {Lijnse and Plasmeijer - 2009 - iTasks 2 iTasks for End-users.pdf:/home/mrl/.local/share/zotero/storage/KACEWKXY/Lijnse and Plasmeijer - 2009 - iTasks 2 iTasks for End-users.pdf:application/pdf},
+}
+
 @mastersthesis{bohm_asynchronous_2019,
        address = {Nijmegen},
        title = {Asynchronous {Actions} in a {Synchronous} {World}},
@@ -523,6 +549,16 @@ few changes in existing programs.},
        file = {Baccelli et al. - 2018 - Reprogramming Low-end IoT Devices from the Cloud.pdf:/home/mrl/.local/share/zotero/storage/M6LX5ZJN/Baccelli et al. - 2018 - Reprogramming Low-end IoT Devices from the Cloud.pdf:application/pdf},
 }
 
+@mastersthesis{piers_task-oriented_2016,
+       address = {Nijmegen},
+       title = {Task-{Oriented} {Programming} for developing non-distributed interruptible embedded systems},
+       language = {en},
+       school = {Radboud University},
+       author = {Piers, Jasper},
+       year = {2016},
+       file = {Piers - Task-Oriented Programming for developing non-distr.pdf:/home/mrl/.local/share/zotero/storage/X8BZM9D4/Piers - Task-Oriented Programming for developing non-distr.pdf:application/pdf},
+}
+
 @inproceedings{baccelli_scripting_2018,
        title = {Scripting {Over}-{The}-{Air}: {Towards} {Containers} on {Low}-end {Devices} in the {Internet} of {Things}},
        booktitle = {{IEEE} {PerCom} 2018},
@@ -566,12 +602,23 @@ few changes in existing programs.},
        file = {groj10-Haskell_front_end_Clean.pdf:/home/mrl/.local/share/zotero/storage/WVZWX8WT/groj10-Haskell_front_end_Clean.pdf:application/pdf},
 }
 
+@article{plasmeijer_itasks:_2007,
+       title = {{iTasks}: executable specifications of interactive work flow systems for the web},
+       volume = {42},
+       number = {9},
+       journal = {ACM SIGPLAN Notices},
+       author = {Plasmeijer, Rinus and Achten, Peter and Koopman, Pieter},
+       year = {2007},
+       pages = {141--152},
+       file = {plar2007-ICFP07-iTasks.pdf:/home/mrl/.local/share/zotero/storage/N8EUZP7D/plar2007-ICFP07-iTasks.pdf:application/pdf},
+}
+
 @incollection{plasmeijer_shallow_2016,
        address = {Cham},
        series = {Lecture {Notes} in {Computer} {Science}},
        title = {A {Shallow} {Embedded} {Type} {Safe} {Extendable} {DSL} for the {Arduino}},
        volume = {9547},
-       isbn = {978-3-319-39109-0 978-3-319-39110-6},
+       isbn = {978-3-319-39110-6},
        url = {http://link.springer.com/10.1007/978-3-319-39110-6},
        urldate = {2017-02-22},
        booktitle = {Trends in {Functional} {Programming}},
@@ -737,7 +784,6 @@ Publisher: Association for Computing Machinery},
        journal = {Parallel Processing Letters},
        author = {Hammond, Kevin and Berthold, Jost and Loogen, Rita},
        year = {2003},
-       note = {\_eprint: https://doi.org/10.1142/S0129626403001380},
        pages = {413--424},
        file = {Hammond et al. - 2003 - AUTOMATIC SKELETONS IN TEMPLATE HASKELL.pdf:/home/mrl/.local/share/zotero/storage/HBQ8UXY3/Hammond et al. - 2003 - AUTOMATIC SKELETONS IN TEMPLATE HASKELL.pdf:application/pdf},
 }
@@ -918,7 +964,7 @@ Publisher: Association for Computing Machinery},
        author = {Shioda, Masato and Iwasaki, Hideya and Sato, Shigeyuki},
        year = {2014},
        note = {event-place: VästerÃ¥s, Sweden},
-       keywords = {D language, Embedded domain specific languages, Library, Metaprogramming},
+       keywords = {Metaprogramming, D language, Embedded domain specific languages, Library},
        pages = {63--72},
        file = {Shioda et al. - 2014 - LibDSL A Library for Developing Embedded Domain S.pdf:/home/mrl/.local/share/zotero/storage/3WFYJPFR/Shioda et al. - 2014 - LibDSL A Library for Developing Embedded Domain S.pdf:application/pdf},
 }
@@ -954,7 +1000,7 @@ Publisher: Association for Computing Machinery},
        author = {Eisenberg, Richard A. and Stolarek, Jan},
        year = {2014},
        note = {event-place: Gothenburg, Sweden},
-       keywords = {defunctionalization, Haskell, type-level programming},
+       keywords = {Haskell, defunctionalization, type-level programming},
        pages = {95--106},
        file = {Eisenberg and Stolarek - 2014 - Promoting Functions to Type Families in Haskell.pdf:/home/mrl/.local/share/zotero/storage/PQXGBM6M/Eisenberg and Stolarek - 2014 - Promoting Functions to Type Families in Haskell.pdf:application/pdf},
 }
@@ -972,7 +1018,7 @@ Publisher: Association for Computing Machinery},
        author = {Viera, Marcos and Balestrieri, Florent and Pardo, Alberto},
        year = {2018},
        note = {event-place: Lowell, MA, USA},
-       keywords = {Attribute Grammars, Dynamics, EDSL, Haskell, Staging},
+       keywords = {Haskell, EDSL, Attribute Grammars, Dynamics, Staging},
        pages = {95--106},
        file = {Viera et al. - 2018 - A Staged Embedding of Attribute Grammars in Haskel.pdf:/home/mrl/.local/share/zotero/storage/53D4HT9C/Viera et al. - 2018 - A Staged Embedding of Attribute Grammars in Haskel.pdf:application/pdf},
 }
@@ -1132,7 +1178,7 @@ Publisher: Association for Computing Machinery},
        author = {Najd, Shayan and Lindley, Sam and Svenningsson, Josef and Wadler, Philip},
        year = {2016},
        note = {event-place: St. Petersburg, FL, USA},
-       keywords = {domain-specific language, DSL, EDSL, embedded language, normalisation, QDSL, quotation, subformula principle},
+       keywords = {EDSL, domain-specific language, DSL, embedded language, normalisation, QDSL, quotation, subformula principle},
        pages = {25--36},
        file = {Najd et al. - 2016 - Everything Old is New Again Quoted Domain-Specifi.pdf:/home/mrl/.local/share/zotero/storage/NZJW5ZVF/Najd et al. - 2016 - Everything Old is New Again Quoted Domain-Specifi.pdf:application/pdf},
 }
@@ -1248,6 +1294,7 @@ Publisher: Association for Computing Machinery},
        author = {{Peter T. Lewis}},
        month = sep,
        year = {1985},
+       annote = {By connecting devices such as traffic signal control boxes, underground gas station tanks and home refrigerators to supervisory control systems, modems, auto-dialers and cellular phones, we can transmit status of these devices to cell sites, then pipe that data through the Internet and address it to people near and far that need that information.  I predict that not only humans, but machines and other things will interactively communicate via the Internet.  The Internet of Things, or IoT, is the integration of people, processes and technology with connectable devices and sensors to enable remote monitoring, status, manipulation and evaluation of trends of such devices.  When all these technologies and voluminous amounts of Things are interfaced together -- namely, devices/machines, supervisory controllers, cellular and the Internet, there is nothing we cannot connect to and communicate with.  What I am calling the Internet of Things will be far reaching.},
 }
 
 @article{weiser_computer_1991,
@@ -1405,17 +1452,6 @@ Publisher: Association for Computing Machinery},
        file = {Crooijmans - 2021 - Reducing the Power Consumption of IoT Devices in T.pdf:/home/mrl/.local/share/zotero/storage/YIEQ97KK/Crooijmans - 2021 - Reducing the Power Consumption of IoT Devices in T.pdf:application/pdf},
 }
 
-@article{mcdonell_embedded_2021,
-       title = {Embedded {Pattern} {Matching}},
-       volume = {abs/2108.13114},
-       url = {https://arxiv.org/abs/2108.13114},
-       journal = {CoRR},
-       author = {McDonell, Trevor L. and Meredith, Joshua D. and Keller, Gabriele},
-       year = {2021},
-       note = {arXiv: 2108.13114},
-       file = {2108.13114.pdf:/home/mrl/.local/share/zotero/storage/AJAT8AXI/2108.13114.pdf:application/pdf},
-}
-
 @misc{wadler_expression_1998,
        title = {The expression problem},
        url = {https://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt},
@@ -1425,6 +1461,9 @@ Publisher: Association for Computing Machinery},
        month = nov,
        year = {1998},
        note = {e-mail message, accessed on 2021-02-24},
+       annote = {
+
+},
 }
 
 @misc{margaret_deuter_rhapsody_2015,
@@ -1446,6 +1485,7 @@ Publisher: Association for Computing Machinery},
        author = {{Wikipedia contributors}},
        year = {2022},
        note = {accessed on: 2022-09-06},
+       annote = {[Online; accessed 6-September-2022]},
 }
 
 @incollection{backus_introduction_1990,
@@ -1563,7 +1603,7 @@ Publisher: Association for Computing Machinery},
        author = {de Vries, Edsko and Löh, Andres},
        year = {2014},
        note = {event-place: Gothenburg, Sweden},
-       keywords = {datatype-generic programming, generic views, json, lenses, metadata, sums of products, universes},
+       keywords = {lenses, datatype-generic programming, generic views, json, metadata, sums of products, universes},
        pages = {83--94},
        file = {de Vries and Löh - 2014 - True Sums of Products.pdf:/home/mrl/.local/share/zotero/storage/QHT5IPQA/de Vries and Löh - 2014 - True Sums of Products.pdf:application/pdf},
 }
@@ -1598,7 +1638,7 @@ Publisher: Association for Computing Machinery},
        author = {Pickering, Matthew and Wu, Nicolas and Kiss, Csongor},
        year = {2019},
        note = {event-place: Berlin, Germany},
-       keywords = {implicits, metaprogramming, staging},
+       keywords = {metaprogramming, staging, implicits},
        pages = {71--84},
        file = {Pickering et al. - 2019 - Multi-Stage Programs in Context.pdf:/home/mrl/.local/share/zotero/storage/3EW7FM44/Pickering et al. - 2019 - Multi-Stage Programs in Context.pdf:application/pdf},
 }
@@ -1607,6 +1647,7 @@ Publisher: Association for Computing Machinery},
        title = {A {Specification} for {Typed} {Template} {Haskell}},
        volume = {abs/2112.03653},
        url = {https://arxiv.org/abs/2112.03653},
+       doi = {10.48550/arXiv.2112.03653},
        journal = {CoRR},
        author = {Pickering, Matthew and Löh, Andres and Wu, Nicolas},
        year = {2021},
@@ -1691,6 +1732,74 @@ Publisher: Association for Computing Machinery},
        year = {2015},
        doi = {10.3990/1.9789036538039},
        note = {ISBN: 978-90-365-3803-9},
-       keywords = {Digital Circuits, EC Grant Agreement nr.: FP7/248465, EC Grant Agreement nr.: FP7/610686, EWI-23939, FPGA, Functional Programming, Hardware, Haskell, IR-93962, Lambda calculus, METIS-308711, Rewrite Systems},
+       keywords = {Haskell, Digital Circuits, EC Grant Agreement nr.: FP7/248465, EC Grant Agreement nr.: FP7/610686, EWI-23939, FPGA, Functional Programming, Hardware, IR-93962, Lambda calculus, METIS-308711, Rewrite Systems},
+       annote = {eemcs-eprint-23939 },
        file = {Baaij - 2015 - Digital circuit in CλaSH functional specification.pdf:/home/mrl/.local/share/zotero/storage/MYJ33ISL/Baaij - 2015 - Digital circuit in CλaSH functional specification.pdf:application/pdf},
 }
+
+@inproceedings{mcdonell_embedded_2022,
+       address = {New York, NY, USA},
+       series = {Haskell 2022},
+       title = {Embedded {Pattern} {Matching}},
+       isbn = {978-1-4503-9438-3},
+       url = {https://doi.org/10.1145/3546189.3549917},
+       doi = {10.1145/3546189.3549917},
+       abstract = {Haskell is a popular choice for hosting deeply embedded languages. A recurring challenge for these embeddings is how to seamlessly integrate user defined algebraic data types. In particular, one important, convenient, and expressive feature for creating and inspecting data—pattern matching—is not directly available on embedded terms. We present a novel technique, embedded pattern matching, which enables a natural and user friendly embedding of user defined algebraic data types into the embedded language, and allows programmers to pattern match on terms in the embedded language in much the same way they would in the host language.},
+       booktitle = {Proceedings of the 15th {ACM} {SIGPLAN} {International} {Haskell} {Symposium}},
+       publisher = {Association for Computing Machinery},
+       author = {McDonell, Trevor L. and Meredith, Joshua D. and Keller, Gabriele},
+       year = {2022},
+       note = {event-place: Ljubljana, Slovenia},
+       keywords = {Haskell, algebraic data types, embedded languages, pattern matching},
+       pages = {123--136},
+       file = {2108.13114.pdf:/home/mrl/.local/share/zotero/storage/AJAT8AXI/2108.13114.pdf:application/pdf},
+}
+
+@phdthesis{krishnamurthi_linguistic_2001,
+       address = {Houston, USA},
+       type = {{PhD} {Thesis}},
+       title = {Linguistic reuse},
+       school = {Rice University},
+       author = {Krishnamurthi, Shriram},
+       year = {2001},
+       file = {Krishnamurthi - 2001 - Linguistic reuse.PDF:/home/mrl/.local/share/zotero/storage/LSKHFPIS/Krishnamurthi - 2001 - Linguistic reuse.PDF:application/pdf},
+}
+
+@misc{ashton_internet_1999,
+       address = {London, UK},
+       type = {Presentation},
+       title = {Internet of {Things}},
+       author = {Ashton, Kevin},
+       year = {1999},
+}
+
+@article{ashton_that_2009,
+       title = {That â€˜{Internet} of {Things}’ {Thing}},
+       volume = {22},
+       number = {7},
+       journal = {RFID journal},
+       author = {Ashton, Kevin},
+       year = {2009},
+       note = {Publisher: Hauppauge, New York},
+       pages = {97--114},
+       file = {Ashton - 2009 - That â€˜Internet of Things’ Thing.pdf:/home/mrl/.local/share/zotero/storage/SJ33G6VR/Ashton - 2009 - That â€˜Internet of Things’ Thing.pdf:application/pdf},
+}
+
+@phdthesis{van_gemert_task_2022,
+       address = {Nijmegen},
+       type = {Bachelor's {Thesis}},
+       title = {Task {Oriented} {Programming} in {LUA}},
+       language = {en},
+       school = {Radboud University},
+       author = {van Gemert, Dante},
+       year = {2022},
+       file = {van Gemert - 2022 - Task Oriented Programming in LUA.pdf:/home/mrl/.local/share/zotero/storage/UQHAWT83/van Gemert - 2022 - Task Oriented Programming in LUA.pdf:application/pdf},
+}
+
+@misc{lijnse_toppyt_2022,
+       title = {Toppyt},
+       url = {https://gitlab.com/baslijnse/toppyt},
+       urldate = {2022-10-07},
+       author = {Lijnse, Bas},
+       year = {2022},
+}
index 94383b2..b285f89 100644 (file)
@@ -1,6 +1,8 @@
+% chktex-file 17
+% chktex-file 15
 % Fonts
 \usepackage[utf8]{inputenc} % Input encoding
-\usepackage[T1]{fontenc}    % Font encoding
+\usepackage[T2A,T1]{fontenc}    % Font encoding
 \usepackage{lmodern}        % Nicer font
 \usepackage{microtype}      % Better kerning
 \usepackage{tipa}           % IPA symbols
@@ -11,6 +13,7 @@
 \usepackage{amssymb}        % extra math symbols
 \usepackage{relsize}        % \smaller command
 \usepackage{siunitx}        % typeset units
+\usepackage{xcolor}         % colors
 \DeclareSIUnit\noop{\relax}
 \DeclareSIUnit\celcius{{}^{\circ}\kern-\scriptspace\mathsf{C}}
 %\usepackage{atveryend}        % \smaller command
 \renewcommand\partname{Movement}                   % Rename parts to movements (rhapsody uhu)
 \addto\captionsbritish{\renewcommand{\partname}{Movement}}
 \usepackage{titlesec}
-\makeatletter
 \titleformat{\part}[block]
        {\Huge}
        {\partname~\thepart:}
        {20pt}
        {}
-
-\newenvironment{chapterabstract}
-       {\begin{quote}}
-       {\end{quote}}
+% This is required to make \nameref work (https://tex.stackexchange.com/questions/211035/problems-with-nameref-not-refering-to-the-correct-label-x-titlesec)
+\makeatletter
+\let\titlesec@part\part%
+\renewcommand{\part}{\@ifstar\part@star\part@nostar}
+\def\part@star#1{\NR@gettitle{#1}\titlesec@part*{#1}}
+\def\part@nostar{\@ifnextchar[\part@nostar@opt\part@nostar@nopt} % chktex 9
+\def\part@nostar@nopt#1{\NR@gettitle{#1}\titlesec@part{#1}}
+\def\part@nostar@opt[#1]#2{\NR@gettitle{#1}\titlesec@part[#1]{#2}}
+\makeatother
+\newenvironment{chapterabstract}{\begin{quotation}}{\end{quotation}}
 
 % Increase the depth for the table of contents
 \setcounter{secnumdepth}{3}
 
 % (file) structure
 \usepackage[subpreambles=true]{standalone} % standalone figures
-\usepackage{morewrites}                    % fix no more room for a new \write
+%\usepackage{morewrites}                    % fix no more room for a new \write
 \usepackage{appendix}                      % subappendices, appendices per chapter
 
 % Bibliography
 \nobibliography*
 \usepackage{natbib} % Cite bib entry completely
 \setlength{\bibsep}{0.0pt}
+\def\bibfont{\small}
 %\bibliographystyle{alpha}
 \bibliographystyle{abbrvnat}
+\apptocmd{\thebibliography}{\raggedright}{}{}
 
 % Graphics
 \usepackage{graphicx} % Images
-\graphicspath{{img/},{introduction/img}}
-\graphicspath{{img/},{introduction/img},{tiered_vs._tierless_programming/img}}
+\graphicspath{{img/},{intro/img},{top/img},{tvt/img}}
 \usepackage{caption}  % subfigures
 \usepackage{subcaption}
 \usepackage{rotating}
 \newcommand{\orcid}[1]{\href{https://orcid.org/#1}{\hspace{1mm}\includegraphics[width=1em]{orcid}\hspace{2mm} https://orcid.org/#1}}
+\usepackage{tikz}
 
 % Tables
 \usepackage{booktabs}  % Nicer tables
 % Fix the algorithm font
 \renewcommand\AlCapFnt{\normalfont}
 \usepackage{listings}
+% https://tex.stackexchange.com/questions/149056/how-can-i-define-additional-literate-replacements-without-deleting-existing-ones
+\makeatletter
+\def\addToLiterate#1{\edef\lst@literate{\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}}
+\lst@Key{moreliterate}{}{\addToLiterate{#1}}
+\makeatother
 % General listings settings
 \lstset{%
        basewidth=0.5em,
        breaklines=true,
        captionpos=b,
        columns=[c]fixed,
-%      columns=flexible,
        commentstyle=\sl,
        escapeinside={[+}{+]},  % chktex 9
        frame=L,
 }
 \usepackage{lstlangclean}
 \usepackage{lstlanghaskell}
-\usepackage{lstlanghaskelllhstex}
 \usepackage{lstlangarduino}
+\lstloadlanguages{%
+       {[Arduino]C++},%
+       {c},%
+       {Python},%
+       {Clean},%
+       {[Regular]Haskell},
+       {[Lhs2Tex]Haskell}}
 \newcommand{\cinline}[1]{\lstinline[language=c,basicstyle=\tt,postbreak=]|#1|}
 \newcommand{\arduinoinline}[1]{\lstinline[language={[Arduino]C++},basicstyle=\tt,postbreak=]|#1|}
 \newcommand{\pythoninline}[1]{\lstinline[language=Python,basicstyle=\tt,postbreak=]|#1|}
 \newcommand{\cleaninline}[1]{\lstinline[language=Clean,basicstyle=\tt,postbreak=]|#1|}
-\newcommand{\haskellinline}[1]{\lstinline[language=Haskell,style=haskell,basicstyle=\tt,postbreak=]|#1|}
-\newcommand{\haskelllhstexinline}[1]{\lstinline[language=Haskell,style=haskelllhstex,basicstyle=\tt,postbreak=]|#1|}
+\newcommand{\haskellinline}[1]{\lstinline[language={[Regular]Haskell},basicstyle=\tt,postbreak=]|#1|}
+\newcommand{\haskelllhstexinline}[1]{\lstinline[language={[Lhs2Tex]Haskell},basicstyle=\tt,postbreak=]|#1|}
 %For storing listings in footnotes
 \newsavebox{\LstBox}
 % Fix list of listings title
        {}
 \lstnewenvironment{lstHaskell}[1][]
        {%
-               \lstset{language=Haskell,style=haskell,#1}%
+               \lstset{language={[Regular]Haskell},#1}%
                \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}
        }
        {}
 \lstnewenvironment{lstHaskellLhstex}[1][]
        {%
-               \lstset{language=Haskell,style=haskelllhstex,#1}%
+               \lstset{language={[Lhs2Tex]Haskell},#1}%
                \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}
        }
        {}
 \usepackage[noabbrev]{cleveref} % Easy references
 \crefname{part}{movement}{movements}
 \crefname{lstlisting}{listing}{listings}
+\usepackage{nameref} % to reference names of chapters
+\newcommand{\fullref}[1]{\Cref{#1}: \nameref{#1}}
 
 % Glossaries and acronyms
-\usepackage[acronym,nonumberlist]{glossaries}
+\usepackage[nolangwarn,acronym,nonumberlist]{glossaries}
 \Addlcwords{of}
 % Titlecase glossary commands
 \newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}}
 
 % Custom commands
 \newcommand{\GHCmod}[1]{\texttt{#1}}
-\newcommand{\requiresGHCmod}[1]{\footnote{Requires \GHCmod{#1} to be enabled.}}
+\newcommand{\requiresGHCmod}[2][]{\footnote{Requires \GHCmod{#1} to be enabled.#2}}
 \newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}}
 \newcommand{\rdmentry}[6]{#1: #2 (#3): #4. #5.\ \href{https://doi.org/#6}{#6}}
 \newcommand{\mlubbers}{Lubbers, M.\ (Radboud University)}
 \newcommand{\pkoopman}{Koopman, dr.\ P.\ (Radboud University)}
 \newcommand{\rplasmeijer}{Plasmeijer, prof.\ dr.\ ir.\ R.\ (Radboud University)}
 
-\newcommand{\mychapter}[2]{
-       \chapter{#2}%
-       \label{#1}%
-}
-\newcommand{\myappendix}[2]{
-       \chapter{#2}%
-       \label{#1}%
-}
-\newcommand{\mybackmatter}[2]{
-       \chapter{#2}%
-       \label{#1}%
+\newcommand{\mypart}[3]{
+       \part[#2: #3]{#2\\[2ex]\smaller{}#3}%
+       \label{#1}
 }
-\newcommand{\mypart}[3]{\part[#2: #3]{#2\\[2ex]\smaller{}#3}\label{#1}}
diff --git a/process_bib.sh b/process_bib.sh
new file mode 100755 (executable)
index 0000000..f7b3f09
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+if [ $# -eq 0 ]
+then
+       echo "Usage: $0 FILE.bib [FILE.bib ...]"
+       exit
+fi
+sed -i '/url = {https\?:\/\/\(doi.org\|link\.springer\|ieeexplore\|dl\.acm\|services\.igi-global\|arxiv\.org\)/d' "${@}"
index 5a970c3..f98e8d1 100644 (file)
--- a/self.bib
+++ b/self.bib
@@ -57,7 +57,6 @@
        title = {A {Task}-{Based} {DSL} for {Microcomputers}},
        copyright = {All rights reserved},
        isbn = {978-1-4503-6355-6},
-       url = {http://dl.acm.org/citation.cfm?doid=3183895.3183902},
        doi = {10.1145/3183895.3183902},
        abstract = {The Internet of Things, IoT, makes small connected computing devices almost omnipresent. These devices have typically very limited computing power and severe memory restrictions to make them cheap and power efficient. These devices can interact with the environment via special sensors and actuators. Since each device controls several peripherals running interleaved, the control software is quite complicated and hard to maintain. Task Oriented Programming, TOP, offers lightweight communicating threads that can inspect each other’s intermediate results. This makes it well suited for the IoT. In this paper presents a functional task-based domain specific language for these IoT devices. We show that it yields concise control programs. By restricting the datatypes and using strict evaluation these programs fit within the restrictions of microcontrollers.},
        language = {en},
@@ -75,7 +74,6 @@
        series = {{IoT} '20},
        title = {Tiered versus {Tierless} {IoT} {Stacks}: {Comparing} {Smart} {Campus} {Software} {Architectures}},
        isbn = {978-1-4503-8758-3},
-       url = {https://doi.org/10.1145/3410992.3411002},
        doi = {10.1145/3410992.3411002},
        abstract = {Internet of Things (IoT) software stacks are notoriously complex, conventionally comprising multiple tiers/components and requiring that the developer not only uses multiple programming languages, but also correctly interoperate the components. A novel alternative is to use a single tierless language with a compiler that generates the code for each component, and for their correct interoperation.We report the first ever systematic comparison of tiered and tierless IoT software architectures. The comparison is based on two implementations of a non-trivial smart campus application. PRSS has a conventional tiered Python-based architecture, and Clean Wemos Super Sensors (CWSS) has a novel tierless architecture based on Clean and the iTask and mTask embedded DSLs. An operational comparison of CWSS and PRSS demonstrates that they have equivalent functionality, and that both meet the University of Glasgow (UoG) smart campus requirements.Crucially, the tierless CWSS stack requires 70\% less code than the tiered PRSS stack. We analyse the impact of the following three main factors. (1) Tierless developers need to manage less interoperation: CWSS uses two DSLs in a single paradigm where PRSS uses five languages and three paradigms. (2) Tierless developers benefit from automatically generated, and hence correct, communication. (3) Tierless developers can exploit the powerful high-level abstractions such as Task Oriented Programming (TOP) in CWSS. A far smaller and single paradigm codebase improves software quality, dramatically reduces development time, and improves the maintainability of tierless stacks.},
        booktitle = {Proceedings of the 10th {International} {Conference} on the {Internet} of {Things}},
index b8ec716..930e1de 100644 (file)
 \overfullrule=1mm
 
 % Just for the todonotes, can go when it's finished
-\usepackage{todonotes}
+\usepackage[disable]{todonotes}
 \setuptodonotes{
        backgroundcolor=white,
        linecolor=black,
        size=scriptsize,
 }
+%\newcommand{\todo}[2][1]{1}
+%\newcommand{\listoftodos}{}
 
 % Document info
 \title{\mytitle{} --- \mysubtitle{}}
 \frontmatterfancy%
 
 %Titlepage
-\subfile{frontmatter/titlepage}
+\subfile{front/titlepage}
 \newpage%
 
 % Epigraph/motto
-\subfile{frontmatter/motto}
+\subfile{front/motto}
 
 % Table of contents
-%\setcounter{tocdepth}{1}
+\setcounter{tocdepth}{1}
 \tableofcontents
-\todo{reduce tocdepth to 1 before finishing}
 \todo{to reduce the size: make listings font smaller}
 \newpage%
 
 % Dedication
-\subfile{frontmatter/dedication}
-
-\listoftodos%
+\subfile{front/dedication}
 
 % Reset glossary and thus the acronyms
 \glsresetall{}
 \setcounter{chapter}{-1}
 
 % Introduction
-\subfile{introduction/introduction}
+\subfile{intro/introduction}
 % DSL
 
-\mypart{prt:dsl}{Prelude}{Domain-Specific Languages}%
-
-% DSL Techniques
-\subfile{domain-specific_languages/dsl_techniques}
-
-% Deep embedding with class
-\subfile{domain-specific_languages/class_deep_embedding}
-
-% First-class data types
-\subfile{domain-specific_languages/first-class_datatypes}
-
-% Stack computations?
-\subfile{domain-specific_languages/strongly-typed_multi-view_stack-based_computations}
-
-\mypart{prt:top}{Exposition}{Task-Oriented Programming for the Internet of Things}%
-
-\subfile{mtask/mtask}
+\part[Prelude: Domain-Specific Languages]{Prelude:\\[2ex]\smaller{}Domain-Specific Languages}%
+\label{prt:dsl}
+\subfile{dsl/dsl_techniques}        % DSL Techniques
+\subfile{dsl/class_deep_embedding}  % Deep embedding with class
+\subfile{dsl/first-class_datatypes} % First-class data types
 
-\mypart{prt:tvt}{Transformation}{Tiered vs.\ tierless programming}%
+\part[Exposition: Task-Oriented Programming]{Exposition:\\[2ex]\smaller{}Task-Oriented Programming for the Internet of Things}%
+\label{prt:top}
+\subfile{top/mtask} % MTask tutorial and implementation
 
-\subfile{tiered_vs._tierless_programming/smart_campus}
+\part[Transformation: Tiered vs.\ Tierless Programming]{Transformation:\\[2ex]\smaller{}Tiered vs.\ Tierless Programming}%
+\label{prt:tvt}
+\subfile{tvt/tvt} % Could Tierless Languages Reduce IoT Development Grief?
 
 \bookmarksetup{startatroot} % descend back out of the previous part
 \addtocontents{toc}{\bigskip}% Insert some whitespace to make the TOC better
-\subfile{conclusion/conclusion}
+\subfile{concl/conclusion}
 
 % Start appendix
 \appendix%
 \label{chp:appendix}
 \addcontentsline{toc}{part}{Appendix}
 
-\subfile{appendix/clean_for_haskell_programmers}
-\subfile{appendix/mtask_aux}
-\subfile{appendix/bytecode}
+\subfile{appx/clean_for_haskell_programmers}
+\subfile{appx/mtask_aux}
+\subfile{appx/bytecode}
 
 \backmatter%
 \backmatterfancy%
 \bibliography{other,self,tiot}
 
 % Summary
-\subfile{backmatter/summary}
+\subfile{back/summary}
 
 % Samenvatting
-\subfile{backmatter/samenvatting}
+\subfile{back/samenvatting}
 
 % Acknowledgements
-\subfile{backmatter/acknowledgements}
+\subfile{back/acknowledgements}
 
 % Research data management
-\subfile{backmatter/research_data_management}
+\subfile{back/research_data_management}
 
 % Curriculum vitæ
-\subfile{backmatter/curriculum_vitae}
+\subfile{back/curriculum_vitae}
 
 % Glossary
 \addcontentsline{toc}{chapter}{Glossary}%
diff --git a/tiered_vs._tierless_programming/img/arch.pdf b/tiered_vs._tierless_programming/img/arch.pdf
deleted file mode 100644 (file)
index f104628..0000000
Binary files a/tiered_vs._tierless_programming/img/arch.pdf and /dev/null differ
diff --git a/tiered_vs._tierless_programming/img/bar_chart.pdf b/tiered_vs._tierless_programming/img/bar_chart.pdf
deleted file mode 100644 (file)
index 2abbc1b..0000000
Binary files a/tiered_vs._tierless_programming/img/bar_chart.pdf and /dev/null differ
index 882294e..fc4deef 100644 (file)
--- a/tiot.bib
+++ b/tiot.bib
@@ -382,7 +382,6 @@ year = {2015},
 isbn = {9781450333504},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/2745802.2745805},
 doi = {10.1145/2745802.2745805},
 abstract = {Background: Anecdotal evidence suggests that software applications are usually implemented using a combination of (programming) languages. Aim: We want to provide empirical evidence on the phenomenon of multi-language programming. Methods: We use data mining of 1150 open source projects selected for diversity from a public repository to a) investigate the projects for number and type of languages found and the relative sizes of the languages; b) report on associations between the number of languages found and the size, age, number of contributors, and number of commits of a project using a (Quasi-)Poisson regression model, and c) discuss concrete associations between the general-purpose languages and domain-specific languages found using frequent item set mining. Results: We found a) a mean number of 5 languages per project with a clearly dominant main general-purpose language and 5 often-used DSL types, b) a significant influence of the size, number of commits, and the main language on the number of languages as well as no significant influence of age and number of contributors, and c) three language ecosystems grouped around XML, Shell/Make, and HTML/CSS. Conclusions: Multi-language programming seems to be common in open-source projects and is a factor which must be dealt with in tooling and when assessing development and maintenance of such software systems.},
 booktitle = {Proceedings of the 19th International Conference on Evaluation and Assessment in Software Engineering},
@@ -411,7 +410,6 @@ year = {2018},
 isbn = {9781450365031},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/3266237.3266263},
 doi = {10.1145/3266237.3266263},
 abstract = {Contemporary software systems, such as the Internet of Things (IoT), Industry 4.0, and Smart Cities are new technology paradigms that offer challenges for their construction since they are calling into question our traditional form of developing software. They are a promising paradigm for the integration of devices and communications technologies. It is leading to a shift from the classical monolithic view of development where stakeholder receive a software product at the end (that we have been doing for decades), to software systems materialized through physical objects interconnected by networks and with embedded software to support daily activities. We need therefore to revisit our way of developing software systems and start to consider the particularities required by these new sorts of applications. This paper presents research toward the definition of a framework to support the systems engineering of IoT applications, where we evolved the Zachman's Framework as an alternative to the organization of this architecture. The activities were two folded to address this goal: a) we identified leading concerns of IoT applications, recovered from technical literature, practitioners and a Government Report, in different studies; b) we structured the IoT paradigm in different facets. These activities provided 14 significant concerns and seven facets that together represent the engineering challenges to be faced both by research and practice towards the advancement of IoT in practice.},
 booktitle = {Proceedings of the XXXII Brazilian Symposium on Software Engineering},
@@ -547,7 +545,6 @@ year = {2020},
 isbn = {9781450381789},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/3426428.3426921},
 doi = {10.1145/3426428.3426921},
 abstract = {Lines-of-code metrics (loc) are commonly reported in Programming Languages (PL), Software Engineering (SE), and Systems papers. This convention has several different, often contradictory, goals, including demonstrating the `hardness' of a problem, and demonstrating the `easiness' of a problem. In many cases, the reporting of loc metrics is done not with a clearly communicated intention, but instead in an automatic, checkbox-ticking, manner.  In this paper we investigate the uses of code metrics in PL, SE, and System papers. We consider the different goals that reporting metrics aims to achieve, several various domains wherein metrics are relevant, and various alternative metrics and their pros and cons for the different goals and domains. We argue that communicating claims about research software is usually best achieved not by reporting quantitative metrics, but by reporting the qualitative experience of researchers, and propose guidelines for the cases when quantitative metrics are appropriate.  We end with a case study of the one area in which lines of code are not the default measurement---code produced by papers' solutions---and identify how measurements offered are used to support an explicit claim about the algorithm. Inspired by this positive example, we call for other cogent measures to be developed to support other claims authors wish to make.},
 booktitle = {Proceedings of the 2020 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software},
@@ -565,7 +562,6 @@ series = {Onward! 2020}
        isbn = {9781450308601},
        publisher = {Association for Computing Machinery},
        address = {New York, NY, USA},
-       url = {https://doi.org/10.1145/2034675.2034690},
        doi = {10.1145/2034675.2034690},
        abstract = {We present Cloud Haskell, a domain-specific language for developing programs for a distributed computing environment. Implemented as a shallow embedding in Haskell, it provides a message-passing communication model, inspired by Erlang, without introducing incompatibility with Haskell's established shared-memory concurrency. A key contribution is a method for serializing function closures for transmission across the network. Cloud Haskell has been implemented; we present example code and some preliminary performance measurements.},
        booktitle = {Proceedings of the 4th ACM Symposium on Haskell},
@@ -662,7 +658,6 @@ series = {Onward! 2020}
        isbn = {1581131259},
        publisher = {Association for Computing Machinery},
        address = {New York, NY, USA},
-       url = {https://doi.org/10.1145/325694.325709},
        doi = {10.1145/325694.325709},
        abstract = {This paper describes a new approach to generic functional programming, which allows us to define functions generically for all datatypes expressible in Haskell. A generic function is one that is defined by induction on the structure of types. Typical examples include pretty printers, parsers, and comparison functions. The advanced type system of Haskell presents a real challenge: datatypes may be parameterized not only by types but also by type constructors, type definitions may involve mutual recursion, and recursive calls of type constructors can be arbitrarily nested. We show that—despite this complexity—a generic function is uniquely defined by giving cases for primitive types and type constructors (such as disjoint unions and cartesian products). Given this information a generic function can be specialized to arbitrary Haskell datatypes. The key idea of the approach is to model types by terms of the simply typed Î»-calculus augmented by a family of recursion operators. While conceptually simple, our approach places high demands on the type system: it requires polymorphic recursion, rank-n types, and a strong form of type constructor polymorphism. Finally, we point out connections to Haskell's class system and show that our approach generalizes type classes in some respects.},
        booktitle = {Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
@@ -678,7 +673,6 @@ series = {Onward! 2020}
        isbn = {9781450315227},
        publisher = {Association for Computing Machinery},
        address = {New York, NY, USA},
-       url = {https://doi.org/10.1145/2370776.2370801},
        doi = {10.1145/2370776.2370801},
        abstract = {Task-Oriented Programming (TOP) is a novel programming paradigm for the construction of distributed systems where users work together on the internet. When multiple users collaborate, they need to interact with each other frequently. TOP supports the definition of tasks that react to the progress made by others. With TOP, complex multi-user interactions can be programmed in a declarative style just by defining the tasks that have to be accomplished, thus eliminating the need to worry about the implementation detail that commonly frustrates the development of applications for this domain. TOP builds on four core concepts: tasks that represent computations or work to do which have an observable value that may change over time, data sharing enabling tasks to observe each other while the work is in progress, generic type driven generation of user interaction, and special combinators for sequential and parallel task composition. The semantics of these core concepts is defined in this paper. As an example we present the iTask3 framework, which embeds TOP in the functional programming language Clean.},
        booktitle = {Proceedings of the 14th Symposium on Principles and Practice of Declarative Programming},
@@ -742,7 +736,6 @@ series = {Onward! 2020}
     isbn = {9781450332842},
     publisher = {Association for Computing Machinery},
     address = {New York, NY, USA},
-    url = {https://doi.org/10.1145/2746325.2746333},
     doi = {10.1145/2746325.2746333},
     abstract = {Most complex applications inevitably need to maintain dependencies between subsystems based on some shared data. The dependent parts must be informed that the shared information is changed. As every actual notification has some communication cost, and every triggered task has associated computation cost, it is crucial for the overall performance of the application to reduce the number of notifications as much as possible. To achieve this, one must be able to define, with arbitrary precision, which party is depending on which data. In this paper we offer a general solution to this general problem. The solution is based on an extension to bidirectional lenses, called parametric lenses. With the help of parametric lenses one can define compositional parametric views in a declarative way to access some shared data. Parametric views, besides providing read/write access to the shared data, also enable to observe changes of some parts, given by an explicit parameter, the focus domain. The focus domain can be specified as a type-based query language defined over one or more resources using predefined combinators of parametric views.},
     booktitle = {Proceedings of the 26th  International Symposium on Implementation and Application of Functional Languages},
@@ -753,22 +746,6 @@ series = {Onward! 2020}
     series = {IFL '14}
 }
 
-@inproceedings{steenvoorden_tophat_2019,
-       address = {New York, NY, USA},
-       series = {{PPDP} '19},
-       title = {{TopHat}: {A} {Formal} {Foundation} for {Task}-{Oriented} {Programming}},
-       isbn = {978-1-4503-7249-7},
-       url = {https://doi.org/10.1145/3354166.3354182},
-       doi = {10.1145/3354166.3354182},
-       abstract = {Software that models how people work is omnipresent in today's society. Current languages and frameworks often focus on usability by non-programmers, sacrificing flexibility and high level abstraction. Task-oriented programming (TOP) is a programming paradigm that aims to provide the desired level of abstraction while still being expressive enough to describe real world collaboration. It prescribes a declarative programming style to specify multi-user workflows. Workflows can be higher-order. They communicate through typed values on a local and global level. Such specifications can be turned into interactive applications for different platforms, supporting collaboration during execution. TOP has been around for more than a decade, in the forms of iTasks and mTasks, which are tailored for real-world usability. So far, it has not been given a formalisation which is suitable for formal reasoning.In this paper we give a description of the TOP paradigm and then decompose its rich features into elementary language elements, which makes them suitable for formal treatment. We use the simply typed lambda-calculus, extended with pairs and references, as a base language. On top of this language, we develop TopHat, a language for modular interactive workflows. We describe TopHat by means of a layered semantics. These layers consist of multiple big-step evaluations on expressions, and two labelled transition systems, handling user inputs.With TopHat we prepare a way to formally reason about TOP languages and programs. This approach allows for comparison with other work in the field. We have implemented the semantic rules of TopHat in Haskell, and the task layer on top of the iTasks framework. This shows that our approach is feasible, and lets us demonstrate the concepts by means of illustrative case studies. TOP has been applied in projects with the Dutch coast guard, tax office, and navy. Our work matters because formal program verification is important for mission-critical software, especially for systems with concurrency.},
-       booktitle = {Proceedings of the 21st {International} {Symposium} on {Principles} and {Practice} of {Declarative} {Programming}},
-       publisher = {Association for Computing Machinery},
-       author = {Steenvoorden, Tim and Naus, Nico and Klinik, Markus},
-       year = {2019},
-       note = {event-place: Porto, Portugal},
-       file = {Steenvoorden et al. - 2019 - TopHat A Formal Foundation for Task-Oriented Prog.pdf:/home/mrl/.local/share/zotero/storage/W7HJ5MEF/Steenvoorden et al. - 2019 - TopHat A Formal Foundation for Task-Oriented Prog.pdf:application/pdf}
-}
-
 @article{10.1145/1543134.1411301,
     author = {Rodriguez, Alexey and Jeuring, Johan and Jansson, Patrik and Gerdes, Alex and Kiselyov, Oleg and Oliveira, Bruno C. d. S.},
     title = {Comparing Libraries for Generic Programming in Haskell},
@@ -779,7 +756,6 @@ series = {Onward! 2020}
     volume = {44},
     number = {2},
     issn = {0362-1340},
-    url = {https://doi.org/10.1145/1543134.1411301},
     doi = {10.1145/1543134.1411301},
     abstract = {Datatype-generic programming is defining functions that depend on the structure, or "shape", of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. There are morethan 10 proposals for generic programming libraries orlanguage extensions for Haskell. To compare and characterise the many generic programming libraries in atyped functional language, we introduce a set of criteria and develop a generic programming benchmark: a set of characteristic examples testing various facets of datatype-generic programming. We have implemented the benchmark for nine existing Haskell generic programming libraries and present the evaluation of the libraries. The comparison is useful for reaching a common standard for generic programming, but also for a programmer who has to choose a particular approach for datatype-generic programming.},
     journal = {SIGPLAN Not.},
@@ -796,7 +772,6 @@ series = {Onward! 2020}
     isbn = {9781605580647},
     publisher = {Association for Computing Machinery},
     address = {New York, NY, USA},
-    url = {https://doi.org/10.1145/1411286.1411301},
     doi = {10.1145/1411286.1411301},
     abstract = {Datatype-generic programming is defining functions that depend on the structure, or "shape", of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. There are morethan 10 proposals for generic programming libraries orlanguage extensions for Haskell. To compare and characterise the many generic programming libraries in atyped functional language, we introduce a set of criteria and develop a generic programming benchmark: a set of characteristic examples testing various facets of datatype-generic programming. We have implemented the benchmark for nine existing Haskell generic programming libraries and present the evaluation of the libraries. The comparison is useful for reaching a common standard for generic programming, but also for a programmer who has to choose a particular approach for datatype-generic programming.},
     booktitle = {Proceedings of the First ACM SIGPLAN Symposium on Haskell},
@@ -830,7 +805,6 @@ series = {Onward! 2020}
     isbn = {0897919181},
     publisher = {Association for Computing Machinery},
     address = {New York, NY, USA},
-    url = {https://doi.org/10.1145/258948.258973},
     doi = {10.1145/258948.258973},
     abstract = {Fran (Functional Reactive Animation) is a collection of data types and functions for composing richly interactive, multimedia animations. The key ideas in Fran are its notions of behaviors and events. Behaviors are time-varying, reactive values, while events are sets of arbitrarily complex conditions, carrying possibly rich information. Most traditional values can be treated as behaviors, and when images are thus treated, they become animations. Although these notions are captured as data types rather than a programming language, we provide them with a denotational semantics, including a proper treatment of real time, to guide reasoning and implementation. A method to effectively and efficiently perform event detection using interval analysis is also described, which relies on the partial information structure on the domain of event times. Fran has been implemented in Hugs, yielding surprisingly good performance for an interpreter-based system. Several examples are given, including the ability to describe physical phenomena involving gravity, springs, velocity, acceleration, etc. using ordinary differential equations.},
     booktitle = {Proceedings of the Second ACM SIGPLAN International Conference on Functional Programming},
@@ -889,7 +863,6 @@ year = {1990},
 isbn = {089791368X},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/91556.91592},
 doi = {10.1145/91556.91592},
 abstract = {Category theorists invented monads in the 1960's to concisely express certain aspects of universal algebra. Functional programmers invented list comprehensions in the 1970's to concisely express certain programs involving lists. This paper shows how list comprehensions may be generalised to an arbitrary monad, and how the resulting programming feature can concisely express in a pure functional language some programs that manipulate state, handle exceptions, parse text, or invoke continuations. A new solution to the old problem of destructive array update is also presented. No knowledge of category theory is assumed.},
 booktitle = {Proceedings of the 1990 ACM Conference on LISP and Functional Programming},
@@ -920,7 +893,6 @@ year = {2010},
 isbn = {9781450300193},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/1806596.1806601},
 doi = {10.1145/1806596.1806601},
 abstract = {Programming language specifications mandate static and dynamic analyses to preclude syntactic and semantic errors. Although individual languages are usually well-specified, composing languages is not, and this poor specification is a source of many errors in multilingual programs. For example, virtually all Java programs compose Java and C using the Java Native Interface (JNI). Since JNI is informally specified, developers have difficulty using it correctly, and current Java compilers and virtual machines (VMs) inconsistently check only a subset of JNI constraints.This paper's most significant contribution is to show how to synthesize dynamic analyses from state machines to detect foreign function interface (FFI) violations. We identify three classes of FFI constraints encoded by eleven state machines that capture thousands of JNI and Python/C FFI rules. We use a mapping function to specify which state machines, transitions, and program entities (threads, objects, references) to check at each FFI call and return. From this function, we synthesize a context-specific dynamic analysis to find FFI bugs. We build bug detection tools for JNI and Python/C using this approach. For JNI, we dynamically and transparently interpose the analysis on Java and C language transitions through the JVM tools interface. The resulting tool, called Jinn, is compiler and virtual machine independent. It detects and diagnoses a wide variety of FFI bugs that other tools miss. This approach greatly reduces the annotation burden by exploiting common FFI constraints: whereas the generated Jinn code is 22,000+ lines, we wrote only 1,400 lines of state machine and mapping code. Overall, this paper lays the foundation for a more principled approach to developing correct multilingual software and a more concise and automated approach to FFI specification.},
 booktitle = {Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation},
@@ -943,7 +915,6 @@ address = {New York, NY, USA},
 volume = {45},
 number = {6},
 issn = {0362-1340},
-url = {https://doi.org/10.1145/1809028.1806601},
 doi = {10.1145/1809028.1806601},
 abstract = {Programming language specifications mandate static and dynamic analyses to preclude syntactic and semantic errors. Although individual languages are usually well-specified, composing languages is not, and this poor specification is a source of many errors in multilingual programs. For example, virtually all Java programs compose Java and C using the Java Native Interface (JNI). Since JNI is informally specified, developers have difficulty using it correctly, and current Java compilers and virtual machines (VMs) inconsistently check only a subset of JNI constraints.This paper's most significant contribution is to show how to synthesize dynamic analyses from state machines to detect foreign function interface (FFI) violations. We identify three classes of FFI constraints encoded by eleven state machines that capture thousands of JNI and Python/C FFI rules. We use a mapping function to specify which state machines, transitions, and program entities (threads, objects, references) to check at each FFI call and return. From this function, we synthesize a context-specific dynamic analysis to find FFI bugs. We build bug detection tools for JNI and Python/C using this approach. For JNI, we dynamically and transparently interpose the analysis on Java and C language transitions through the JVM tools interface. The resulting tool, called Jinn, is compiler and virtual machine independent. It detects and diagnoses a wide variety of FFI bugs that other tools miss. This approach greatly reduces the annotation burden by exploiting common FFI constraints: whereas the generated Jinn code is 22,000+ lines, we wrote only 1,400 lines of state machine and mapping code. Overall, this paper lays the foundation for a more principled approach to developing correct multilingual software and a more concise and automated approach to FFI specification.},
 journal = {SIGPLAN Not.},
@@ -959,7 +930,6 @@ year = {2005},
 isbn = {1595930566},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/1065010.1065019},
 doi = {10.1145/1065010.1065019},
 abstract = {We present a multi-lingual type inference system for checking type safety across a foreign function interface. The goal of our system is to prevent foreign function calls from introducing type and memory safety violations into an otherwise safe language. Our system targets OCaml's FFI to C, which is relatively lightweight and illustrates some interesting challenges in multi-lingual type inference. The type language in our system embeds OCaml types in C types and vice-versa, which allows us to track type information accurately even through the foreign language, where the original types are lost. Our system uses representational types that can model multiple OCaml types, because C programs can observe that many OCaml types have the same physical representation. Furthermore, because C has a low-level view of OCaml data, our inference system includes a dataflow analysis to track memory offsets and tag information. Finally, our type system includes garbage collection information to ensure that pointers from the FFI to the OCaml heap are tracked properly. We have implemented our inference system and applied it to a small set of benchmarks. Our results show that programmers do misuse these interfaces, and our implementation has found several bugs and questionable coding practices in our benchmarks.},
 booktitle = {Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation},
@@ -980,7 +950,6 @@ address = {New York, NY, USA},
 volume = {40},
 number = {6},
 issn = {0362-1340},
-url = {https://doi.org/10.1145/1064978.1065019},
 doi = {10.1145/1064978.1065019},
 abstract = {We present a multi-lingual type inference system for checking type safety across a foreign function interface. The goal of our system is to prevent foreign function calls from introducing type and memory safety violations into an otherwise safe language. Our system targets OCaml's FFI to C, which is relatively lightweight and illustrates some interesting challenges in multi-lingual type inference. The type language in our system embeds OCaml types in C types and vice-versa, which allows us to track type information accurately even through the foreign language, where the original types are lost. Our system uses representational types that can model multiple OCaml types, because C programs can observe that many OCaml types have the same physical representation. Furthermore, because C has a low-level view of OCaml data, our inference system includes a dataflow analysis to track memory offsets and tag information. Finally, our type system includes garbage collection information to ensure that pointers from the FFI to the OCaml heap are tracked properly. We have implemented our inference system and applied it to a small set of benchmarks. Our results show that programmers do misuse these interfaces, and our implementation has found several bugs and questionable coding practices in our benchmarks.},
 journal = {SIGPLAN Not.},
@@ -1177,7 +1146,6 @@ address = {New York, NY, USA},
 volume = {49},
 number = {12},
 issn = {0362-1340},
-url = {https://doi.org/10.1145/2775050.2633367},
 doi = {10.1145/2775050.2633367},
 abstract = {We propose a new programming model for web applications which is (1) seamless; one program and one language is used to produce code for both client and server, (2) client-centric; the programmer takes the viewpoint of the client that runs code on the server rather than the other way around, (3) functional and type-safe, and (4) portable; everything is implemented as a Haskell library that implicitly takes care of all networking code. Our aim is to improve the painful and error-prone experience of today's standard development methods, in which clients and servers are coded in different languages and communicate with each other using ad-hoc protocols. We present the design of our library called Haste.App, an example web application that uses it, and discuss the implementation and the compiler technology on which it depends.},
 journal = {SIGPLAN Not.},
@@ -1223,7 +1191,6 @@ year = {2019},
 isbn = {9781450375627},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/3412932.3412941},
 doi = {10.1145/3412932.3412941},
 abstract = {More and more applications rely on the safe execution of code unknown at compile-time, for example in the implementation of web browsers and plugin systems. Furthermore, these applications usually require some form of communication between the added code and its embedder, and hence a communication channel must be set up in which values are serialized and deserialized. This paper shows that in a functional programming language we can solve these two problems at once, if we realize that the execution of extra code is nothing more than the deserialization of a value which happens to be a function. To demonstrate this, we describe the implementation of a serialization library for the language Clean, which internally uses an interpreter to evaluate added code in a separate, sandboxed environment. Remarkable is that despite the conceptual asymmetry between "host" and "interpreter", lazy interworking must be implemented in a highly symmetric fashion, much akin to distributed systems. The library interworks on a low level with the native Clean program, but has been implemented without any changes to the native runtime system. It can therefore easily be ported to other programming languages.We can use the same technique in the context of the web, where we want to be able to share possibly lazy values between a server and a client. In this case the interpreter runs in WebAssembly in the browser and communicates seamlessly with the server, written in Clean. We use this in the iTasks web framework to handle communication and offload computations to the client to reduce stress on the server-side. Previously, this framework cross-compiled the Clean source code to JavaScript and used JSON for communication. The interpreter has a more predictable and better performance, and integration is much simpler because it interworks on a lower level with the web server.},
 booktitle = {Proceedings of the 31st Symposium on Implementation and Application of Functional Languages},
@@ -1278,7 +1245,6 @@ series = {IFL '19}
        address = {Cham},
        title = {Functional {Reactive} {EDSL} with {Asynchronous} {Execution} for {Resource}-{Constrained} {Embedded} {Systems}},
        isbn = {978-3-030-26428-4},
-       url = {https://doi.org/10.1007/978-3-030-26428-4_12},
        abstract = {This paper presents a functionalWang, Sheng reactive embedded domain-specific language (EDSL) for resource-constrained embedded systems and its efficient execution method. In the language, time-varying values changes at discrete points of time rather than continuously. Combined with a mechanismWatanabe, Takuo to let users designate the update interval of values, it is possible to derive the minimal value-updates required to produce the user-desired output. Also, the event-driven backend asynchronously updates an input value when its value is required. In this way, we can greatly reduce the number of updates.},
        booktitle = {Software {Engineering}, {Artificial} {Intelligence}, {Networking} and {Parallel}/{Distributed} {Computing}},
        publisher = {Springer International Publishing},
@@ -1294,7 +1260,6 @@ series = {IFL '19}
        address = {New York, NY, USA},
        title = {Towards {Secure} {IoT} {Programming} in {Haskell}},
        isbn = {978-1-4503-8050-8},
-       url = {https://doi.org/10.1145/3406088.3409027},
        abstract = {IoT applications are often developed in programming languages with low-level abstractions, where a seemingly innocent mistake might lead to severe security vulnerabilities. Current IoT development tools make it hard to identify these vulnerabilities as they do not provide end-to-end guarantees about how data flows within and between appliances. In this work we present Haski, an embedded domain specific language in Haskell (eDSL) for secure programming of IoT devices. Haski enables developers to write Haskell programs that generate C code without falling into many of C’s pitfalls. Haski is designed after the synchronous programming language Lustre, and sports a backwards compatible information-flow control extension to restrict how sensitive data is propagated and modified within the application. We present a novel eDSL design which uses recursive monadic bindings and allows a natural use of functions and pattern-matching in Haskell to write Haski programs. To showcase Haski, we implement a simple smart house controller where communication is done via low-energy Bluetooth on Zephyr OS.},
        booktitle = {Proceedings of the 13th {ACM} {SIGPLAN} {International} {Symposium} on {Haskell}},
        publisher = {Association for Computing Machinery},
@@ -1309,7 +1274,6 @@ series = {IFL '19}
        series = {{PPDP} '20},
        title = {Hailstorm: {A} {Statically}-{Typed}, {Purely} {Functional} {Language} for {IoT} {Applications}},
        isbn = {978-1-4503-8821-4},
-       url = {https://doi.org/10.1145/3414080.3414092},
        doi = {10.1145/3414080.3414092},
        abstract = {With the growing ubiquity of Internet of Things (IoT), more complex logic is being programmed on resource-constrained IoT devices, almost exclusively using the C programming language. While C provides low-level control over memory, it lacks a number of high-level programming abstractions such as higher-order functions, polymorphism, strong static typing, memory safety, and automatic memory management. We present Hailstorm, a statically-typed, purely functional programming language that attempts to address the above problem. It is a high-level programming language with a strict typing discipline. It supports features like higher-order functions, tail-recursion, and automatic memory management, to program IoT devices in a declarative manner. Applications running on these devices tend to be heavily dominated by I/O. Hailstorm tracks side effects like I/O in its type system using resource types. This choice allowed us to explore the design of a purely functional standalone language, in an area where it is more common to embed a functional core in an imperative shell. The language borrows the combinators of arrowized FRP, but has discrete-time semantics. The design of the full set of combinators is work in progress, driven by examples. So far, we have evaluated Hailstorm by writing standard examples from the literature (earthquake detection, a railway crossing system and various other clocked systems), and also running examples on the GRiSP embedded systems board, through generation of Erlang.},
        booktitle = {Proceedings of the 22nd {International} {Symposium} on {Principles} and {Practice} of {Declarative} {Programming}},
@@ -1327,7 +1291,6 @@ year = {2018},
 isbn = {9781450360661},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/3281366.3281370},
 doi = {10.1145/3281366.3281370},
 abstract = {Reactive programming over a network is a challenging task because efficient elimination of temporary violations of data flow invariants, known as glitches, in a distributed setting is still an open issue. In this paper, we propose a method for constructing a distributed reactive programming system of which runtime guarantees the properties of single source glitch-freedom and the robustness against out-of-order messages. Based on the method, we developed a purely functional reactive programming language XFRP whose compiler produces Erlang code. Using some examples, we show that the proposed method is beneficial for constructing distributed reactive applications without suffering from inconsistencies.},
 booktitle = {Proceedings of the 8th ACM SIGPLAN International Workshop on Programming Based on Actors, Agents, and Decentralized Control},
@@ -1362,7 +1325,6 @@ series = {AGERE 2018}
        series = {{AGERE} 2018},
        title = {Distributed {Functional} {Reactive} {Programming} on {Actor}-{Based} {Runtime}},
        isbn = {978-1-4503-6066-1},
-       url = {https://doi.org/10.1145/3281366.3281370},
        doi = {10.1145/3281366.3281370},
        abstract = {Reactive programming over a network is a challenging task because efficient elimination of temporary violations of data flow invariants, known as glitches, in a distributed setting is still an open issue. In this paper, we propose a method for constructing a distributed reactive programming system of which runtime guarantees the properties of single source glitch-freedom and the robustness against out-of-order messages. Based on the method, we developed a purely functional reactive programming language XFRP whose compiler produces Erlang code. Using some examples, we show that the proposed method is beneficial for constructing distributed reactive applications without suffering from inconsistencies.},
        booktitle = {Proceedings of the 8th {ACM} {SIGPLAN} {International} {Workshop} on {Programming} {Based} on {Actors}, {Agents}, and {Decentralized} {Control}},
@@ -1380,7 +1342,6 @@ series = {AGERE 2018}
        series = {Haskell '02},
        title = {Functional {Reactive} {Programming}, {Continued}},
        isbn = {1-58113-605-6},
-       url = {https://doi.org/10.1145/581690.581695},
        doi = {10.1145/581690.581695},
        abstract = {Functional Reactive Programming (FRP) extends a host programming language with a notion of time flow. Arrowized FRP (AFRP) is a version of FRP embedded in Haskell based on the arrow combinators. AFRP is a powerful synchronous dataflow programming language with hybrid modeling capabilities, combining advanced synchronous dataflow features with the higher-order lazy functional abstractions of Haskell. In this paper, we describe the AFRP programming style and our Haskell-based implementation. Of particular interest are the AFRP combinators that support dynamic collections and continuation-based switching. We show how these combinators can be used to express systems with an evolving structure that are difficult to model in more traditional dataflow languages.},
        booktitle = {Proceedings of the 2002 {ACM} {SIGPLAN} {Workshop} on {Haskell}},
@@ -1399,7 +1360,6 @@ year = {2014},
 isbn = {9781450332101},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/2661136.2661146},
 doi = {10.1145/2661136.2661146},
 abstract = {Tierless programming languages enable developing the typical server, client and database tiers of a web application as a single mono-linguistic program. This development style is in stark contrast to the current practice which requires combining multiple technologies and programming languages. A myriad of tierless programming languages has already been proposed, often featuring a JavaScript-like syntax. Instead of introducing yet another, we advocate that it should be possible to develop tierless web applications in existing general-purpose languages. This not only reduces the complexity that developers are exposed to, but also precludes the need for new development tools. We concretize this novel approach to tierless programming by discussing requirements on its future instantiations. We explore the design space of the program analysis for determining and the program transformation for realizing the tier split respectively. The former corresponds to new adaptations of an old familiar, program slicing, for tier splitting. The latter includes several strategies for handling cross-tier function calls and data accesses. Using a prototype instantiation for JavaScript, we demonstrate the feasibility of our approach on an example web application. We conclude with a discussion of open questions and challenges for future research.},
 booktitle = {Proceedings of the 2014 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming \& Software},
@@ -1553,7 +1513,6 @@ address = {New York, NY, USA},
 volume = {2},
 number = {1},
 issn = {2691-1914},
-url = {https://doi.org/10.1145/3437537},
 doi = {10.1145/3437537},
 abstract = {The design and development process for internet of things (IoT) applications is more complicated than that for desktop, mobile, or web applications. First, IoT applications require both software and hardware to work together across many different types of nodes with different capabilities under different conditions. Second, IoT application development involves different types of software engineers such as desktop, web, embedded, and mobile to work together. Furthermore, non-software engineering personnel such as business analysts are also involved in the design process. In addition to the complexity of having multiple software engineering specialists cooperating to merge different hardware and software components together, the development process requires different software and hardware stacks to be integrated together (e.g., different stacks from different companies such as Microsoft Azure and IBM Bluemix). Due to the above complexities, non-functional requirements (such as security and privacy, which are highly important in the context of the IoT) tend to be ignored or treated as though they are less important in the IoT application development process. This article reviews techniques, methods, and tools to support security and privacy requirements in existing non-IoT application designs, enabling their use and integration into IoT applications. This article primarily focuses on design notations, models, and languages that facilitate capturing non-functional requirements (i.e., security and privacy). Our goal is not only to analyse, compare, and consolidate the empirical research but also to appreciate their findings and discuss their applicability for the IoT.},
 journal = {ACM Trans. Internet Things},
@@ -1582,7 +1541,6 @@ year = {2019},
 isbn = {9781450372497},
 publisher = {Association for Computing Machinery},
 address = {New York, NY, USA},
-url = {https://doi.org/10.1145/3354166.3354182},
 doi = {10.1145/3354166.3354182},
 booktitle = {Proceedings of the 21st International Symposium on Principles and Practice of Declarative Programming},
 articleno = {17},
similarity index 100%
rename from mtask/.chktexrc
rename to top/.chktexrc
similarity index 57%
rename from mtask/beyond_microprocessors.tex
rename to top/beyond_microprocessors.tex
index 4677fe9..4b4d410 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:async_shares}{\texorpdfstring{\acrshort{TOP}}{TOP} for \texorpdfstring{\acrshort{IOT}}{IoT} beyond microprocessors}
+\chapter{\texorpdfstring{\acrshort{TOP}}{TOP} for \texorpdfstring{\acrshort{IOT}}{IoT} beyond microprocessors}%
+\label{chp:async_shares}
 Async shares paper (parts of TIOT).
 
 \input{subfilepostamble}
similarity index 68%
rename from mtask/integration.tex
rename to top/integration.tex
index 547f38f..6bb3811 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:integrating_mtask}{Integrating mTask tasks with iTask}
+\chapter{Integrating mTask tasks with iTask}%
+\label{chp:integrating_mtask}
 IFL18 paper
 
 \input{subfilepostamble}
similarity index 71%
rename from mtask/interpreting.tex
rename to top/interpreting.tex
index 8011310..79a82c9 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:executing_mtask}{Executing mTask tasks on microcontrollers}
+\chapter{Executing mTask tasks on microcontrollers}%
+\label{chp:executing_mtask}
 IFL19 paper
 4COWS paper
 
similarity index 71%
rename from mtask/mtask.tex
rename to top/mtask.tex
index 1f93e0a..013e84a 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:top4iot}{Introduction to \texorpdfstring{\gls{IOT}}{IoT} programming}
+\chapter{Introduction to \texorpdfstring{\gls{IOT}}{IoT} programming}%
+\label{chp:top4iot}
 \todo{betere chapter naam}
 \begin{chapterabstract}
        This chapter introduces \gls{MTASK} and puts it into perspective compared to traditional microprocessor programming.
@@ -96,10 +97,10 @@ Unfortunately, this is very hard when for example the blinking patterns are dete
 long led1 = 0, led2 = 0, led3 = 0;
 bool st1 = false, st2 = false, st3 = false;
 
-void blink(int pin, int delay, long *lastrun, bool *st) {
-       if (millis() - *lastrun > delay) {
+void blink(int pin, int dlay, long *lastrun, bool *st) {
+       if (millis() - *lastrun > dlay) {
                digitalWrite(pin, *st = !*st);
-               *lastrun += delay;
+               *lastrun += dlay;
        }
 }
 
@@ -114,13 +115,14 @@ Furthermore, it is very difficult to represent dependencies between threads, oft
 
 \section{Blinking in \texorpdfstring{\gls{MTASK}}{mTask}}
 The \cleaninline{delay} \emph{task} does not block the execution but \emph{just} emits no value when the target waiting time has not yet passed and emits a stable value when the time is met.
-In contrast, the \cleaninline{delay} \emph{function} on the \gls{ARDUINO} is blocking which prohibits interleaving.
+In contrast, the \arduinoinline{delay()} \emph{function} on the \gls{ARDUINO} is blocking which prohibits interleaving.
 To make code reuse possible and make the implementation more intuitive, the blinking behaviour is lifted to a recursive function instead of using the imperative \cleaninline{rpeat} construct.
 The function is parametrized with the current state, the pin to blink and the waiting time.
 Creating recursive functions like this is not possible in the \gls{ARDUINO} language because the program would run out of stack in an instant and nothing can be interleaved.
 With a parallel combinator, tasks can be executed in an interleaved fashion.
 Therefore, blinking three different blinking patterns is as simple as combining the three calls to the \cleaninline{blink} function with their arguments as seen in \cref{lst:blinkthreadmtask}.
 
+% VimTeX: SynIgnore on
 \begin{lstClean}[label={lst:blinkthreadmtask},caption={Threaded blinking.}]
 blinktask :: MTask v () | mtask v
 blinktask =
@@ -135,8 +137,10 @@ blinktask =
                .||. blink (true, d2, lit 300)
                .||. blink (true, d3, lit 800)
        }\end{lstClean}
+% VimTeX: SynIgnore off
 
-\mychapter{chp:mtask_dsl}{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\gls{DSL}}{DSL}}
+\chapter{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\gls{DSL}}{DSL}}%
+\label{chp:mtask_dsl}
 \begin{chapterabstract}
 This chapter serves as a complete guide to the \gls{MTASK} language, from an \gls{MTASK} programmer's perspective.
 \end{chapterabstract}
@@ -251,7 +255,8 @@ For convenience, there are many lower-cased macro definitions for often used con
 \Cref{lst:example_exprs} shows some examples of these expressions.
 \cleaninline{e0} defines the literal $42$, \cleaninline{e1} calculates the literal $42.0$ using real numbers.
 \cleaninline{e2} compares \cleaninline{e0} and \cleaninline{e1} as integers and if they are equal it returns the \cleaninline{e2}$/2$ and \cleaninline{e0} otherwise.
-\cleaninline{approxEqual} performs an approximate equality---albeit not taking into account all floating point pecularities---and demonstrates that \gls{CLEAN} can be used as a macro language.
+\cleaninline{approxEqual} performs an approximate equality---albeit not taking into account all floating point pecularities---and demonstrates that \gls{CLEAN} can be used as a macro language, i.e.\ maximise linguistic reuse~\cite{krishnamurthi_linguistic_2001}.
+\todo{uitzoeken waar dit handig is}
 When calling \cleaninline{approxEqual} in an \gls{MTASK} function, the resulting code is inlined.
 
 \begin{lstClean}[label={lst:example_exprs},caption={Example \gls{MTASK} expressions.}]
@@ -272,8 +277,6 @@ approxEqual x y eps = if' (x == y) true
                (x -. y < eps)
        )
 \end{lstClean}
-%jona
-%jaunda
 
 \subsection{Data Types}
 Most of \gls{CLEAN}'s basic types have been mapped on \gls{MTASK} types.
@@ -322,12 +325,13 @@ Many of the often used functions are already bundled in the \cleaninline{mtask}
 Definiting zero arity functions is shown in the \cleaninline{zeroarity} expression.
 Finally, \cleaninline{swapTuple} shows an example of a tuple being swapped.
 
+% VimTeX: SynIgnore on
 \begin{lstClean}[label={lst:function_examples},caption={Function examples in \gls{MTASK}.}]
 factorial :: Main (v Int) | mtask v
 factorial =
-          fun \fac=(\i->if' (i <. lit 1)
-                       (lit 1)
-                       (i *. fac (i -. lit 1)))
+       fun \fac=(\i->if' (i <. lit 1)
+               (lit 1)
+               (i *. fac (i -. lit 1)))
        In {main = fac (lit 5) }
 
 factorialtail :: Main (v Int) | mtask v & fun (v Int, v Int) v
@@ -349,6 +353,7 @@ swapTuple =
           fun \swap=(tupopen \(x, y)->tupl y x)
        In {main = swap (tupl true (lit 42)) }
 \end{lstClean}
+% VimTeX: SynIgnore off
 
 \section{Tasks}\label{sec:top}
 \Gls{MTASK}'s task language can be divided into three categories, namely
@@ -361,19 +366,29 @@ swapTuple =
 \end{enumerate*}
 
 As \gls{MTASK} is integrated with \gls{ITASK}, the same stability distinction is made for task values.
+A task in \gls{MTASK} is denoted by the \gls{DSL} type synonym shown in \cref{lst:task_type}.
+
+\begin{lstClean}[label={lst:task_type},caption={Task type in \gls{MTASK}.}]
+:: MTask v a :== v (TaskValue a)
+:: TaskValue a
+       = NoValue
+       | Value a Bool
+\end{lstClean}
 
 \subsection{Basic tasks}
 The most rudimentary basic tasks are the \cleaninline{rtrn} and \cleaninline{unstable} tasks.
 They lift the value from the \gls{MTASK} expression language to the task domain either as a stable value or an unstable value.
+There is also a special type of basic task for delaying execution.
+The \cleaninline{delay} task---given a number of milliseconds---yields an unstable value while the time has not passed.
+Once the specified time has passed, the time it overshot the planned time is yielded as a stable task value.
 
 \begin{lstClean}[label={lst:basic_tasks},caption={Function examples in \gls{MTASK}.}]
-class rtrn v :: (v t) -> MTask v t | type t
-class unstable v :: (v t) -> MTask v t | type t
+class rtrn v :: (v t) -> MTask v t
+class unstable v :: (v t) -> MTask v t
+class delay v :: (v n) -> MTask v n | long v n
 \end{lstClean}
 
-\todo{examples}
-
-\subsubsection{Peripherals}
+\subsubsection{Peripherals}\label{sssec:peripherals}
 For every sensor or actuator, basic tasks are available that allow interaction with the specific peripheral.
 The type classes for these tasks are not included in the \cleaninline{mtask} class collection as not all devices nor all language interpretations have such peripherals connected.
 \todo{Historically, peripheral support has been added \emph{by need}.}
@@ -429,79 +444,208 @@ class dio p v | pin p where
        readD :: (v p) -> MTask v Bool | pin p
 
 class pinMode v where
-       pinMode :: (v PinMode) (v p) -> MTask v () | pin, type p
-       declarePin :: p PinMode ((v p) -> Main (v a)) -> Main (v a) | pin p & type a
+       pinMode :: (v PinMode) (v p) -> MTask v () | pin p
+       declarePin :: p PinMode ((v p) -> Main (v a)) -> Main (v a) | pin p
 \end{lstClean}
-\todo{onder Task Combinators verplaatsen zodat de voorbeeldjes leuker kunnen zijn?}
 
 \subsection{Task combinators}
-\subsubsection{Parallel}\label{sssec:combinators_parallel}
-\begin{lstClean}[label={lst:mtask_parallel},caption{Parallel task combinators in \gls{MTASK}.}]
-class (.&&.) infixr 4 v :: (MTask v a) (MTask v b) -> MTask v (a, b) | type a & type b
-class (.||.) infixr 3 v :: (MTask v a) (MTask v a) -> MTask v a | type a
-\end{lstClean}
+Task combinators are used to combine multiple tasks into one to describe workflows.
+There are three main types of task combinators, namely:
+\begin{enumerate*}
+       \item Sequential combinators that execute tasks one after the other, possibly using the result of the left hand side.
+       \item Parallel combinators that execute tasks at the same time combining the result.
+       \item Miscellaneous combinators that change the semantics of a task---e.g.\ repeat it or delay execution.
+\end{enumerate*}
 
 \subsubsection{Sequential}
-\begin{lstClean}[label={lst:mtask_sequential},caption{Sequential task combinators in \gls{MTASK}.}]
+Sequential task combination allows the right-hand side task to observe the left-hand side task value.
+All seqential task combinators are expressed in the \cleaninline{expr} class and can be---and are by default---derived from the Swiss army knife step combinator \cleaninline{>>*.}.
+This combinator has a single task on the left-hand side and a list of \emph{task continuations} on the right-hand side.
+The list of task continuations is checked every rewrite step and if one of the predicates matches, the task continues with the result of this combination.
+\cleaninline{>>=.} is a shorthand for the bind operation, if the left-hand side is stable, the right-hand side function is called to produce a new task.
+\cleaninline{>>|.} is a shorthand for the sequence operation, if the left-hand side is stable, it continues with the right-hand side task.
+The \cleaninline{>>~.} and \cleaninline{>>..} combinators are variants of the ones above that ignore the stability and continue on an unstable value as well.
+
+\begin{lstClean}[label={lst:mtask_sequential},caption={Sequential task combinators in \gls{MTASK}.}]
 class step v | expr v where
-       (>>*.) infixl 1 :: (MTask v t) [Step v t u] -> MTask v u | type u & type t
-       (>>=.) infixl 0 :: (MTask v t) ((v t) -> MTask v u) -> MTask v u | expr v & type u & type t
-       (>>|.) infixl 0 :: (MTask v t) (MTask v u) -> MTask v u | expr v & type u & type t
-       (>>|.) ma mb  = ma >>*. [IfStable (\_->lit True) \_->mb]
-       (>>~.) infixl 0 :: (MTask v t) ((v t) -> MTask v u) -> MTask v u | expr v & type u & type t
-       (>>~.) ma amb = ma >>*. [IfValue (\_->lit True) amb]
-       (>>..) infixl 0 :: (MTask v t) (MTask v u) -> MTask v u | expr v & type u & type t
-       (>>..) ma mb  = ma >>*. [IfValue (\_->lit True) \_->mb]
+       (>>*.) infixl 1 :: (MTask v t) [Step v t u] -> MTask v u
+       (>>=.) infixl 0 :: (MTask v t) ((v t) -> MTask v u) -> MTask v u
+       (>>|.) infixl 0 :: (MTask v t)          (MTask v u) -> MTask v u
+       (>>~.) infixl 0 :: (MTask v t) ((v t) -> MTask v u) -> MTask v u
+       (>>..) infixl 0 :: (MTask v t)          (MTask v u) -> MTask v u
 
 :: Step v t u
        = IfValue    ((v t) -> v Bool) ((v t) -> MTask v u)
        | IfStable   ((v t) -> v Bool) ((v t) -> MTask v u)
        | IfUnstable ((v t) -> v Bool) ((v t) -> MTask v u)
-       | Always                            (MTask v u)
+       | Always                                (MTask v u)
+\end{lstClean}
+
+\todo{more examples step?}
+
+The following listing shows an example of a step in action.
+The \cleaninline{readPinBin} function produces an \gls{MTASK} task that classifies the value of an analogue pin into four bins.
+It also shows that the nature of embedding allows the host language to be used as a macro language.
+Furthermore
+
+\begin{lstClean}[label={lst:mtask_readpinbin},caption={Read an analog pin and bin the value in \gls{MTASK}.}]
+readPinBin :: Int -> Main (MTask v Int) | mtask v
+readPinBin lim = declarePin PMInput A2 \a2->
+       { main = readA a2 >>*.
+               [  IfValue (\x->x <. lim) (\_->rtrn (lit bin))
+               \\ lim <-[64,128,192,256]
+               &  bin <- [0..]]}
 \end{lstClean}
 
-\subsubsection{Miscellaneous}
-\begin{lstClean}[label={lst:mtask_misc},caption{Miscellaneous task combinators in \gls{MTASK}.}]
+\subsubsection{Parallel}\label{sssec:combinators_parallel}
+The result of a parallel task combination is a compound that actually executes the tasks at the same time.
+
+There are two types of parallel task combinators (see \cref{lst:mtask_parallel}).
+The conjunction combinator (\cleaninline{.&&.}) combines the result by putting the values from both sides in a tuple.
+The stability of the task depends on the stability of both children.
+If both children are stable, the result is stable, otherwise the result is unstable.
+The disjunction combinator (\cleaninline{.\|\|.}) combines the results by picking the leftmost, most stable task.
+The semantics are easily described using \gls{CLEAN} functions shown in \cref{lst:semantics_con,lst:semantics_dis}.
+
+\begin{figure}[ht]
+       \centering
+       \begin{subfigure}[t]{.5\textwidth}
+               \begin{lstClean}[caption={Semantics of the\\conjunction combinator.},label={lst:semantics_con}]
+con :: (TaskValue a) (TaskValue b)
+       -> TaskValue (a, b)
+con NoValue r       = NoValue
+con l       NoValue = NoValue
+con (Value l ls) (Value r rs)
+       = Value (l, r) (ls && rs)
+
+               \end{lstClean}
+       \end{subfigure}%
+       \begin{subfigure}[t]{.5\textwidth}
+               \begin{lstClean}[caption={Semantics of the\\disjunction combinator.},label={lst:semantics_dis}]
+dis :: (TaskValue a) (TaskValue a)
+       -> TaskValue a
+dis NoValue r       = r
+dis l       NoValue = l
+dis (Value l ls) (Value r rs)
+       | rs        = Value r True
+       | otherwise = Value l ls
+               \end{lstClean}
+       \end{subfigure}
+\end{figure}
+
+\begin{lstClean}[label={lst:mtask_parallel},caption={Parallel task combinators in \gls{MTASK}.}]
+class (.&&.) infixr 4 v :: (MTask v a) (MTask v b) -> MTask v (a, b)
+class (.||.) infixr 3 v :: (MTask v a) (MTask v a) -> MTask v a
+\end{lstClean}
+
+\Cref{lst:mtask_parallel_example} gives an example of the parallel task combinator.
+This program will read two pins at the same time, returning when one of the pins becomes \arduinoinline{HIGH}.
+If the combinator was the \cleaninline{.&&.} instead, the type would be \cleaninline{MTask v (Bool, Bool)} and the task would only return when both pins have been \arduinoinline{HIGH} but not necessarily at the same time.
+
+\begin{lstClean}[label={lst:mtask_parallel_example},caption={Parallel task combinator example in \gls{MTASK}.}]
+task :: MTask v Bool
+task =
+       declarePin D0 PMInput \d0->
+       declarePin D1 PMInput \d1->
+       let monitor pin = readD pin >>*. [IfValue (\x->x) \x->rtrn x]
+       In {main = monitor d0 .||. monitor d1}
+\end{lstClean}
+
+\subsubsection{Repeat}
+The \cleaninline{rpeat} combinator executes the child task.
+If a stable value is observed, the task is reinstated.
+The functionality of \cleaninline{rpeat} can also be simulated by using functions and sequential task combinators and even made to be stateful as can be seen in \cref{lst:blinkthreadmtask}.
+
+\begin{lstClean}[label={lst:mtask_repeat},caption={Repeat task combinators in \gls{MTASK}.}]
 class rpeat v where
-       /**
-        * Executes the task until it yields a stable value, after which it is restarted.
-        *
-        * @param task
-        * @param the transformed task
-        */
-       rpeat :: (MTask v a) -> MTask v a | type a
-       rpeat t :== rpeatEvery Default t
-       /**
-        * Executes the task until it yields a stable value, after which it is restarted at most once every given timing interval.
-        *
-        * @param restarting interval
-        * @param task
-        * @param the transformed task
-        */
-       rpeatEvery :: (TimingInterval v) (MTask v a) -> MTask v a | type a
-
-/**
- * The basic task that waits for a specified amount of time
- *
- * @var view
- * @param number of milliseconds to wait
- * @result task that yields
- *   - when the time has passed: a stable value with the number of milliseconds it overshot the waiting time
- *   - when the time has not passed: an unstable value with the number of milliseconds it still needs to wait
- */
-class delay v :: (v n) -> MTask v Long | type n & long v n
+       rpeat :: (MTask v a) -> MTask v a
+\end{lstClean}
+
+To demonstrate the combinator, \cref{lst:mtask_repeat_example} show \cleaninline{rpeat} in use.
+This task will mirror the value read from analog \gls{GPIO} pin \cleaninline{A1} to pin \cleaninline{A2} by constantly reading the pin and writing the result.
+
+\begin{lstClean}[label={lst:mtask_repeat_example},caption={Exemplatory repeat task in \gls{MTASK}.}]
+task :: MTask v Int | mtask v
+task =
+       declarePin A1 PMInput \a1->
+       declarePin A2 PMOutput \a2->
+       {main = rpeat (readA a1 >>~. writeA a2)}
 \end{lstClean}
 
 \subsection{\texorpdfstring{\Acrlongpl{SDS}}{Shared data sources}}
+\Glspl{SDS} in \gls{MTASK} are by default references to shared memory.
+Similar to peripherals (see \cref{sssec:peripherals}), they are constructed at the top level and are accessed through interaction tasks.
+The \cleaninline{getSds} task yields the current value of the \gls{SDS} as an unstable value.
+This behaviour is similar to the \cleaninline{watch} task in \gls{ITASK}.
+Writing a new value to an \gls{SDS} is done using \cleaninline{setSds}.
+This task yields the written value as a stable result after it is done writing.
+Getting and immediately after setting an \gls{SDS} is not an \emph{atomic} operation.
+It is possible that another task accesses the \gls{SDS} in between.
+To circumvent this issue, \cleaninline{updSds} is created, this task atomically updates the value of the \gls{SDS}.
+
+\begin{lstClean}[label={lst:mtask_sds},caption={\Glspl{SDS} in \gls{MTASK}.}]
+:: Sds a // abstract
+class sds v where
+       sds :: ((v (Sds t)) -> In t (Main (MTask v u))) -> Main (MTask v u)
+       getSds :: (v (Sds t))                -> MTask v t
+       setSds :: (v (Sds t))  (v t)         -> MTask v t
+       updSds :: (v (Sds t)) ((v t) -> v t) -> MTask v t
+\end{lstClean}
 
-\mychapter{chp:green_computing_mtask}{Green computing with \texorpdfstring{\gls{MTASK}}{mTask}}
+\todo{examples sdss}
+
+\chapter{Green computing with \texorpdfstring{\gls{MTASK}}{mTask}}%
+\label{chp:green_computing_mtask}
+
+\chapter{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}%
+\label{chp:integration_with_itask}
+The \gls{MTASK} language is a multi-view \gls{DSL}, i.e.\ there are multiple interpretations possible for a single \gls{MTASK} expression.
+Using the byte code compiler (\cleaninline{BCInterpret}) \gls{DSL} interpretation, \gls{MTASK} tasks can be fully integrated in \gls{ITASK} and executed as if they were regular \gls{ITASK} tasks, sharing data using \gls{ITASK} \glspl{SDS}.
+
+\Cref{fig:mtask_integration} shows the 
+
+\begin{figure}[ht]
+       \centering
+       \includestandalone{mtask_integration}
+       \caption{\Gls{MTASK}'s integration with \gls{ITASK}.}%
+       \label{fig:mtask_integration}
+\end{figure}
 
-\mychapter{chp:integration_with_itask}{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
 \section{Devices}
+\Gls{MTASK} tasks in the byte code compiler view are always executed on a certain device.
+All communication with this device happens through a so-called \emph{channels} \gls{SDS}.
+The channels contain three fields, a queue of messages that are received, a queue of messages to send and a stop flag.
+Every communication method that implements the \cleaninline{channelSync} class can provide the communication with an \gls{MTASK} device.
+As of now, serial port communication, direct \gls{TCP} communication and \gls{MQTT} over \gls{TCP} are supported as communication providers.
+The \cleaninline{withDevice} function transforms a communication provider and a task that does something with this device to an \gls{ITASK} task.
+This task sets up the communication, exchanges specifications, handles errors and cleans up after closing.
+\Cref{lst:mtask_device} shows the types and interface to connecting devices.
+
+\begin{lstClean}[label={lst:mtask_device},caption={Device communication interface in \gls{MTASK}.}]
+:: MTDevice //abstract
+:: Channels :== ([MTMessageFro], [MTMessageTo], Bool)
+
+class channelSync a :: a (sds () Channels Channels) -> Task () | RWShared sds
+
+withDevice :: (a (MTDevice -> Task b) -> Task b) | iTask b & channelSync, iTask a
+
+\end{lstClean}
+
 \section{Lifting tasks}
+Once the connection with the device is established, \ldots
+\begin{lstClean}
+liftmTask :: (Main (BCInterpret (TaskValue u))) MTDevice -> Task u | iTask u
+\end{lstClean}
+
 \section{Lifting \texorpdfstring{\acrlongpl{SDS}}{shared data sources}}
+\begin{lstClean}[label={lst:mtask_itasksds},caption={Lifted \gls{ITASK} \glspl{SDS} in \gls{MTASK}.}]
+class liftsds v where
+       liftsds :: ((v (Sds t))->In (Shared sds t) (Main (MTask v u)))
+               -> Main (MTask v u) | RWShared sds
+\end{lstClean}
 
-\mychapter{chp:implementation}{Implementation}
+\chapter{Implementation}%
+\label{chp:implementation}
 IFL19 paper, bytecode instructieset~\cref{chp:bytecode_instruction_set}
 
 \section{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
@@ -509,11 +653,11 @@ IFL18 paper stukken
 
 \chapter{\texorpdfstring{\gls{MTASK}}{mTask} history}
 \section{Generating \texorpdfstring{\gls{C}/\gls{CPP}}{C/C++} code}
-A first throw at a class-based shallowly \gls{EDSL} for microprocessors was made by Pieter Koopman and Rinus Plasmijer in 2016~\citep{plasmeijer_shallow_2016}.
+A first throw at a class-based shallowly \gls{EDSL} for microprocessors was made by \citet{plasmeijer_shallow_2016}.
 The language was called \gls{ARDSL} and offered a type safe interface to \gls{ARDUINO} \gls{CPP} dialect.
 A \gls{CPP} code generation backend was available together with an \gls{ITASK} simulation backend.
 There was no support for tasks or even functions.
-Some time later in the 2015 CEFP summer school, an extended version was created that allowed the creation of imperative tasks, \glspl{SDS} and the usage of functions~\citep{koopman_type-safe_2019}.
+Some time later in the 2015 \gls{CEFP} summer school, an extended version was created that allowed the creation of imperative tasks, \glspl{SDS} and the usage of functions~\citep{koopman_type-safe_2019}.
 The name then changed from \gls{ARDSL} to \gls{MTASK}.
 
 \section{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
@@ -523,7 +667,7 @@ In this way, entire \gls{IOT} systems could be programmed from a single source.
 However, this version used a simplified version of \gls{MTASK} without functions.
 This was later improved upon by creating a simplified interface where \glspl{SDS} from \gls{ITASK} could be used in \gls{MTASK} and the other way around~\citep{lubbers_task_2018}.
 It was shown by Matheus Amazonas Cabral de Andrade that it was possible to build real-life \gls{IOT} systems with this integration~\citep{amazonas_cabral_de_andrade_developing_2018}.
-Moreover, a course on the \gls{MTASK} simulator was provided at the 2018 CEFP/3COWS winter school in Ko\v{s}ice, Slovakia~\citep{koopman_simulation_2018}.
+Moreover, a course on the \gls{MTASK} simulator was provided at the 2018 \gls{CEFP}/\gls{3COWS} winter school in Ko\v{s}ice, Slovakia~\citep{koopman_simulation_2018}.
 
 \section{Transition to \texorpdfstring{\gls{TOP}}{TOP}}
 The \gls{MTASK} language as it is now was introduced in 2018~\citep{koopman_task-based_2018}.
@@ -531,7 +675,7 @@ This paper updated the language to support functions, tasks and \glspl{SDS} but
 Later the bytecode compiler and \gls{ITASK} integration was added to the language~\citep{lubbers_interpreting_2019}.
 Moreover, it was shown that it is very intuitive to write \gls{MCU} applications in a \gls{TOP} language~\citep{lubbers_multitasking_2019}.
 One reason for this is that a lot of design patterns that are difficult using standard means are for free in \gls{TOP} (e.g.\ multithreading).
-In 2019, the CEFP summer school in Budapest, Hungary hosted a course on developing \gls{IOT} applications with \gls{MTASK} as well~\citep{lubbers_writing_2019}.
+In 2019, the \gls{CEFP} summer school in Budapest, Hungary hosted a course on developing \gls{IOT} applications with \gls{MTASK} as well~\citep{lubbers_writing_2019}.
 
 \section{\texorpdfstring{\gls{TOP}}{TOP}}
 In 2022, the SusTrainable summer school in Rijeka, Croatia hosted a course on developing greener \gls{IOT} applications using \gls{MTASK} as well (the lecture notes are to be written).
similarity index 86%
rename from mtask/mtask_by_example.tex
rename to top/mtask_by_example.tex
index c3d64ac..5accbeb 100644 (file)
@@ -5,7 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:mtask_by_example}{mTask by example}
+\chapter{mTask by example}%
+\label{chp:mtask_by_example}
 Hiermee beginnen, dan is het gelijk duidelijk hoe mTask werkt, dan zijn de volgende chapters implementatie dingen.
 
 CEFP19 lecture notes. Dit evt.\ ook gecombineerd met energy aware \gls{TOP} programming en CEFP22 lecture notes.
diff --git a/tvt/.chktexrc b/tvt/.chktexrc
new file mode 100644 (file)
index 0000000..e62adec
--- /dev/null
@@ -0,0 +1,24 @@
+CmdLine {
+       -v
+}
+VerbEnvir {
+       lstinline lstlisting algorithm code spec lstClean lstHaskell lstHaskellLhstex lstArduino lstPython
+}
+WipeArg {
+       \cinline:{}
+       \cleaninline:{}
+       \pythoninline:{}
+       \haskellinline:{}
+       \haskelllshtexinline:{}
+       \arduinoinline:{}
+       \texttt:{}
+       \url:{}
+       \only:{}
+       \orcid:{}
+}
+Silent {
+       \pause
+}
+MathEnvir {
+       code
+}
similarity index 77%
rename from tiered_vs._tierless_programming/smart_campus.tex
rename to tvt/tvt.tex
index e1fbe34..737088b 100644 (file)
@@ -5,8 +5,8 @@
        \pagenumbering{arabic}
 }{}
 
-\mychapter{chp:smart_campus}{Smart campus application}
-%\title{Could Tierless Languages Reduce IoT Development Grief?}
+\chapter{Could Tierless Languages Reduce IoT Development Grief?}%
+\label{chp:smart_campus}
 
 \begin{chapterabstract}
        \Gls{IOT} software is notoriously complex, conventionally comprising multiple tiers.
 
        We report a systematic comparative evaluation of two tierless language technologies for \gls{IOT} stacks: one for resource-rich sensor nodes (\gls{CLEAN} with \gls{ITASK}), and one for resource-constrained sensor nodes (\gls{CLEAN} with \gls{ITASK} and \gls{MTASK}).
        The evaluation is based on four implementations of a typical smart campus application: two tierless and two \gls{PYTHON}-based tiered.
-       %, with two targeting microcontrollers and two targeting supersensors.
+       %, with two targeting microprocessors and two targeting supersensors.
        \begin{enumerate*}
-               \item We show that tierless languages have the potential to significantly reduce the development effort for \gls{IOT} systems, requiring 70\% less code than the tiered implementations. Careful analysis attributes this code reduction to reduced interoperation (e.g.\ two \glspl{EDSL} and one paradigm versus seven languages and two paradigms), automatically generated distributed communication,  and powerful \gls{IOT} programming abstractions.
+               \item We show that tierless languages have the potential to significantly reduce the development effort for \gls{IOT} systems, requiring 70\% less code than the tiered implementations. Careful analysis attributes this code reduction to reduced interoperation (e.g.\ two \glspl{EDSL} and one paradigm versus seven languages and two paradigms), automatically generated distributed communication, and powerful \gls{IOT} programming abstractions.
                \item We show that tierless languages have the potential to significantly improve the reliability of \gls{IOT} systems, describing how \gls{CLEAN}\slash\gls{ITASK}/\gls{MTASK} maintains type safety, provides higher order failure management, and simplifies maintainability.
-               \item We report the first comparison of a tierless \gls{IOT} codebase for resource-rich sensor nodes with one for resource-constrained sensor nodes. The comparison shows that they have similar code size (within 7\%), and  functional structure.
+               \item We report the first comparison of a tierless \gls{IOT} codebase for resource-rich sensor nodes with one for resource-constrained sensor nodes. The comparison shows that they have similar code size (within 7\%), and functional structure.
                \item We present the first comparison of two tierless \gls{IOT} languages, one for resource-rich sensor nodes, and the other for resource-constrained sensor nodes.
        \end{enumerate*}
 \end{chapterabstract}
@@ -30,41 +30,40 @@ Conventional \gls{IOT} software stacks are notoriously complex and pose very sig
 
 Conventional \gls{IOT} software architectures require the development of separate programs in various programming languages for each of the components/tiers in the stack. This is modular, but a significant burden for developers, and some key challenges are as follows.
 \begin{enumerate*}
-    \item Interoperating components in multiple languages and paradigms increases the developer's cognitive load who must simultaneously think in multiple languages and paradigms, i.e.\ manage significant semantic friction.
+       \item Interoperating components in multiple languages and paradigms increases the developer's cognitive load who must simultaneously think in multiple languages and paradigms, i.e.\ manage significant semantic friction.
        \item The developer must correctly interoperate the components, e.g.\ adhere to the \gls{API} or communication protocols between components.
-    \item To ensure correctness the developer must maintain type safety across a range of very different languages and diverse type systems.
-    \item The developer must deal with the potentially diverse failure modes of each component, and of component interoperations.
+       \item To ensure correctness the developer must maintain type safety across a range of very different languages and diverse type systems.
+       \item The developer must deal with the potentially diverse failure modes of each component, and of component interoperations.
 \end{enumerate*}
 
-A radical alternative development paradigm uses a single  \emph{tierless} language that synthesizes all components/tiers in the software stack. There are established \emph{tierless} languages for web stacks, e.g.\ Links~\citep{cooper2006links} or Hop~\citep{serrano2006hop}.
+A radical alternative development paradigm uses a single \emph{tierless} language that synthesizes all components/tiers in the software stack. There are established \emph{tierless} languages for web stacks, e.g.\ Links~\citep{cooper2006links} or Hop~\citep{serrano2006hop}.
 In a tierless language the developer writes the application as a single program. The code for different tiers is simultaneously checked by the compiler, and compiled to the required component languages. For example, Links compiles to HTML and JavaScript for the web client and to SQL on the server to interact with the database system. Tierless languages for \gls{IOT} stacks are more recent and less common, examples include
 Potato~\citep{troyer_building_2018} and \gls{CLEAN} with \gls{ITASK}\slash\gls{MTASK}~\citep{lubbers_interpreting_2019}.
 
-\Gls{IOT} sensor nodes may be microcontrollers with very limited compute resources, or supersensors: resource-rich single board computers like a Raspberry Pi. A tierless language may target either class of sensor node, and microcontrollers  are the more demanding target due to the limited resources, e.g.\ small memory, executing on bare metal etc.
+\Gls{IOT} sensor nodes may be microprocessors with very limited compute resources, or supersensors: resource-rich single board computers like a Raspberry Pi. A tierless language may target either class of sensor node, and microcontrollers are the more demanding target due to the limited resources, e.g.\ small memory, executing on bare metal etc.
 
 Potentially a tierless language both reduces the development effort and improves correctness as correct interoperation and communication is automatically generated by the compiler. A tierless language may, however, introduce other problems. How expressive is the language? That is, can it readily express the required functionality? How maintainable is the software? Is the generated code efficient in terms of time, space, and power?
 
 
-This paper reports a systematic comparative evaluation of two tierless language technologies for \gls{IOT} stacks: one targeting resource-constrained microcontrollers, and the other resource-rich supersensors. The basis of the comparison is four implementations of a typical smart campus \gls{IOT} stack~\citep{hentschel_supersensors:_2016}. Two implementations are conventional tiered  \gls{PYTHON}-based stacks: \gls{PRS} and \gls{PWS}. The other two implementations are tierless: \gls{CRS} and \gls{CWS}. Our work makes the following research contributions, and the key results are summarised, discussed, and quantified in \cref{sec_t4t:Conclusion}.
+This paper reports a systematic comparative evaluation of two tierless language technologies for \gls{IOT} stacks: one targeting resource-constrained microprocessors, and the other resource-rich supersensors. The basis of the comparison is four implementations of a typical smart campus \gls{IOT} stack~\citep{hentschel_supersensors:_2016}. Two implementations are conventional tiered \gls{PYTHON}-based stacks: \gls{PRS} and \gls{PWS}. The other two implementations are tierless: \gls{CRS} and \gls{CWS}. Our work makes the following research contributions, and the key results are summarised, discussed, and quantified in \cref{sec_t4t:Conclusion}.
 
 \begin{description}
-       \item[C1] We show that \emph{tierless languages have the potential to significantly reduce the development effort for  \gls{IOT} systems}.
-               We  systematically compare code size (\gls{SLOC}) of the four smart campus implementations as a  measure of development effort and maintainability~\citep{alpernaswonderful,rosenberg1997some}.
-        The tierless implementations require 70\% less code than the tiered implementations. We analyse the codebases to attribute the code reduction to three factors.
-        \begin{enumerate*}
-            \item Tierless languages benefit from reduced interoperation, requiring far fewer languages, paradigms and source code files e.g.\ \gls{CWS} uses two languages, one paradigm and three source code files where \gls{PWS} uses seven languages, two paradigms and 35 source code files
-                %\jscomment{check out \url{https://editorsmanual.com/articles/numerals-vs-words-for-numbers/} - do we agree with this?}
+       \item[C1] We show that \emph{tierless languages have the potential to significantly reduce the development effort for \gls{IOT} systems}.
+               We systematically compare code size (\gls{SLOC}) of the four smart campus implementations as a measure of development effort and maintainability~\citep{alpernaswonderful,rosenberg1997some}.
+               The tierless implementations require 70\% less code than the tiered implementations. We analyse the codebases to attribute the code reduction to three factors.
+               \begin{enumerate*}
+                       \item Tierless languages benefit from reduced interoperation, requiring far fewer languages, paradigms and source code files e.g.\ \gls{CWS} uses two languages, one paradigm and three source code files where \gls{PWS} uses seven languages, two paradigms and 35 source code files
                                (\cref{table_t4t:multi,table_t4t:languages,table_t4t:paradigms}).
-            \item Tierless languages benefit from automatically synthesized, and hence correct, communication between components that may be distributed.
-            \item Tierless languages benefit from high-level programming abstractions like compositional and higher-order task combinators (\cref{sec_t4t:ProgrammingComparison}).
-        \end{enumerate*}
+                       \item Tierless languages benefit from automatically synthesized, and hence correct, communication between components that may be distributed.
+                       \item Tierless languages benefit from high-level programming abstractions like compositional and higher-order task combinators (\cref{sec_t4t:ProgrammingComparison}).
+               \end{enumerate*}
 
        \item[C2] We show that \emph{tierless languages have the potential to significantly improve the reliability of \gls{IOT} systems}. We demonstrate how tierless languages preserve type safety, improve maintainability and provide high-level failure management. For example, we illustrate a loss of type safety in \gls{PRS}. We also critique current tool and community support (\cref{sec_t4t:Discussion}).
 
-       \item[C3] We report \emph{the first comparison of a tierless \gls{IOT} codebase for resource-rich sensor nodes with one for resource-constrained sensor nodes}. The tierless smart campus implementations have a very similar code size (within 7\%), as do the tiered implementations. This suggests that the development and maintenance effort of simple tierless \gls{IOT} systems for resource-constrained and for resource-rich sensor nodes is similar, as it is for tiered technologies. The percentages of code required to implement  each \gls{IOT} functionality in the tierless \gls{CLEAN} implementations is very similar, as it is in the tiered \gls{PYTHON} implementations. This suggests that the code for resource-constrained and resource-rich sensor nodes is broadly similar in tierless  technologies, as in tiered technologies (\cref{sec_t4t:resourcerich})
+       \item[C3] We report \emph{the first comparison of a tierless \gls{IOT} codebase for resource-rich sensor nodes with one for resource-constrained sensor nodes}. The tierless smart campus implementations have a very similar code size (within 7\%), as do the tiered implementations. This suggests that the development and maintenance effort of simple tierless \gls{IOT} systems for resource-constrained and for resource-rich sensor nodes is similar, as it is for tiered technologies. The percentages of code required to implement each \gls{IOT} functionality in the tierless \gls{CLEAN} implementations is very similar, as it is in the tiered \gls{PYTHON} implementations. This suggests that the code for resource-constrained and resource-rich sensor nodes is broadly similar in tierless technologies, as in tiered technologies (\cref{sec_t4t:resourcerich})
 
        \item[C4] \emph{We present the first comparison of two tierless \gls{IOT} languages, one designed for resource-constrained sensor nodes (\gls{CLEAN} with \gls{ITASK} and \gls{MTASK}), and the other for resource-rich sensor nodes (\gls{CLEAN} with \gls{ITASK}).}
-    We show that the bare metal execution environment enforces some restrictions on \gls{MTASK} although they remain high level. Moreover, the environment conveys some advantages, e.g.\ better control over timing (\cref{sec_t4t:ComparingTierless}).
+       We show that the bare metal execution environment enforces some restrictions on \gls{MTASK} although they remain high level. Moreover, the environment conveys some advantages, e.g.\ better control over timing (\cref{sec_t4t:ComparingTierless}).
 \end{description}
 
 The current work extends~\citep{lubbers_tiered_2020} as follows. Contributions C3 and C4 are entirely new, and C1 is enhanced by being based on the analysis of four rather than two languages and implementations.
@@ -97,10 +96,21 @@ Web applications are necessarily complex distributed systems, with client browse
 are even more complex as they combine a web application with a second distributed system of sensor and actuator nodes that collect and aggregate data, operate on it, and communicate with the server.
 
 Both web and \gls{IOT} applications are commonly structured into tiers, e.g.\ the classical four-tier Linux, Apache, MySQL and PHP (LAMP) stack.
-\Gls{IOT} stacks typically have more tiers than webapps, with the number  depending on the  complexity of the application~\citep{sethi2017internet}. While other tiers, like the business layer~\citep{muccini2018iot} may be added above them, the focus of our study is on programming the lower four tiers of the \gls{PRS}, \gls{CRS}, \gls{PWS} and \gls{CWS} stacks, as illustrated in \cref{fig_t4t:iot_arch}.
+\Gls{IOT} stacks typically have more tiers than webapps, with the number depending on the complexity of the application~\citep{sethi2017internet}. While other tiers, like the business layer~\citep{muccini2018iot} may be added above them, the focus of our study is on programming the lower four tiers of the \gls{PRS}, \gls{CRS}, \gls{PWS} and \gls{CWS} stacks, as illustrated in \cref{fig_t4t:iot_arch}.
+
+\begin{description}%[style=nextline]
+       \item [Perception layer] collects the data, interacts with the environment, and consists of devices using light, sound, motion, air quality and temperature sensors.
+       \item [Network layer] replays the communication messages between the sensor nodes and the server through protocols such as \gls{MQTT}.
+       
+       \item [Application layer] acts as the interface between the presentation layer and the perception layer, storing and processing the data.
+       
+       \item [Presentation layer] utilises web components as the interface between the human and devices where application services are provided.
+       
+\end{description}
+
 
 \begin{landscape}
-       \begin{figure}[ht]
+       \begin{figure}
                \includegraphics[width=\linewidth]{arch}
                \caption{%
                        \gls{PRS} and \gls{PWS} (left) together with \gls{CRS} and \gls{PRS} (right) mapped to the four-tier \gls{IOT} architecture.
@@ -111,59 +121,41 @@ Both web and \gls{IOT} applications are commonly structured into tiers, e.g.\ th
                \label{fig_t4t:iot_arch}
        \end{figure}
 \end{landscape}
-%
-\begin{enumerate}
-
-       \item Perception Layer {--} collects the data, interacts with the environment, and consists of devices using light, sound, motion, air quality and temperature sensors.
-       \item Network Layer {--} replays the communication messages between the sensor nodes and the server through protocols such as \gls{MQTT}.
-       
-       \item Application Layer {--} acts as the interface between the presentation layer and the perception layer, storing and processing the data.
-       
-       \item Presentation Layer {--} utilises web components as the interface between the human and devices where application services are provided.
-       
-\end{enumerate}
-
 
 \subsection{The benefits and challenges of developing tiered \texorpdfstring{\gls{IOT}}{IoT} stacks}
 
 Using multiple tiers to
 structure complex software is a common software engineering practice that provides significant architectural benefits for \gls{IOT} and other software. The tiered \gls{PYTHON} \gls{PRS} and \gls{PWS} stacks exhibit these benefits.
-\begin{enumerate}
+\begin{description}
 
-       \item Modularity: tiers allow a system to be structured as a set of components with clearly defined functionality. They can be implemented independently, and may be interchanged with other components that have similar functionality~\citep{maccormack2007impact}. In \gls{PRS} and \gls{PWS}, for example, a different NoSQL DBMS could relatively easily be substituted for {MongoDB}
+       \item[Modularity] tiers allow a system to be structured as a set of components with clearly defined functionality. They can be implemented independently, and may be interchanged with other components that have similar functionality~\citep{maccormack2007impact}. In \gls{PRS} and \gls{PWS}, for example, a different NoSQL DBMS could relatively easily be substituted for {MongoDB}.
 
-       \item Abstraction: the hierarchical composition of components in the stack abstracts the view of the system as a whole. Enough detail is provided to understand the roles of each layer and how the components relate to one another~\citep{belle2013layered}. \Cref{fig_t4t:iot_arch} illustrates the abstraction of \gls{PRS} and \gls{PWS} into four tiers.
+       \item[Abstraction] the hierarchical composition of components in the stack abstracts the view of the system as a whole. Enough detail is provided to understand the roles of each layer and how the components relate to one another~\citep{belle2013layered}. \Cref{fig_t4t:iot_arch} illustrates the abstraction of \gls{PRS} and \gls{PWS} into four tiers.
 
-       \item Cohesion: well-defined boundaries ensure each tier contains functionality directly related to the task of the component~\citep{lee2001component}. The tiers in \gls{PRS} and \gls{PWS} contain all the functionality associated with perception, networking, application and presentation respectively.
+       \item[Cohesion] well-defined boundaries ensure each tier contains functionality directly related to the task of the component~\citep{lee2001component}. The tiers in \gls{PRS} and \gls{PWS} contain all the functionality associated with perception, networking, application and presentation respectively.
 
-\end{enumerate}
+\end{description}
 
 However, a tiered architecture poses significant challenges for developers of \gls{IOT} and other software. The tiered \gls{PYTHON} \gls{PRS} and \gls{PWS} stacks exhibit these challenges, and we analyse these in detail later in the paper.
 
-\begin{enumerate}
-
-       \item Polyglot Development {--} the developer must be fluent in all the languages and components in the stack, known as being a full stack developer for webapps~\citep{mazzei2018full}. That is, the developer must correctly use multiple languages that have different paradigms, i.e.\ manage significant \emph{semantic friction}~\citep{ireland2009classification}. For example the \gls{PWS} developer must integrate components written in seven languages with two paradigms (\cref{sec_t4t:interoperation}).
-
-       \item Correct Interoperation {--} the developer must adhere to the \gls{API} or communication protocols between components. \Cref{sec_t4t:codesize,sec_t4t:resourcerich} show that communication requires some 17\% of \gls{PRS} and \gls{PWS} code, so around 100 \gls{SLOC}. \Cref{sec_t4t:Communication} discusses the complexity of writing this distributed communication code.
-       
-       \item Maintaining Type Safety {--} is a key element of the semantic friction encountered in multi-language stacks, and crucial for correctness. The developer must maintain type safety across a range of very different languages and diverse type systems, with minimal tool support. We show an example where \gls{PRS} loses type safety over the network layer (\Cref{sec_t4t:typesafety}).
-       
-       
-    \item Managing multiple failure modes {--} different components may have different failure modes, and these must be coordinated. \Cref{sec_t4t:NetworkManagement} outlines how \gls{PRS}  and \gls{PWS}  use heartbeats to manage failures.
-\end{enumerate}
-
+\begin{description}
+       \item[Polyglot development] the developer must be fluent in all the languages and components in the stack, known as being a full-stack developer for webapps \citep{mazzei2018full}. That is, the developer must correctly use multiple languages that have different paradigms, i.e.\ manage significant \emph{semantic friction}~\citep{ireland2009classification}. For example the \gls{PWS} developer must integrate components written in seven languages with two paradigms (\cref{sec_t4t:interoperation}).
+       \item[Correct interoperation] the developer must adhere to the \gls{API} or communication protocols between components. \Cref{sec_t4t:codesize,sec_t4t:resourcerich} show that communication requires some 17\% of \gls{PRS} and \gls{PWS} code, so around 100 \gls{SLOC}. \Cref{sec_t4t:Communication} discusses the complexity of writing this distributed communication code.
+       \item[Maintaining type safety] is a key element of the semantic friction encountered in multi-language stacks, and crucial for correctness. The developer must maintain type safety across a range of very different languages and diverse type systems, with minimal tool support. We show an example where \gls{PRS} loses type safety over the network layer (\Cref{sec_t4t:typesafety}).
+       \item[Managing multiple failure modes] different components may have different failure modes, and these must be coordinated. \Cref{sec_t4t:NetworkManagement} outlines how \gls{PRS} and \gls{PWS} use heartbeats to manage failures.
+\end{description}
 
-Beyond \gls{PRS}  and \gls{PWS} the challenges of tiered polyglot software development are evidenced in real world studies. As recent examples, a study of GitHub open source projects found an average of five different languages in each project, with many using tiered architectures~\citep{mayer2017multi}.
+Beyond \gls{PRS} and \gls{PWS} the challenges of tiered polyglot software development are evidenced in real world studies. As recent examples, a study of GitHub open source projects found an average of five different languages in each project, with many using tiered architectures~\citep{mayer2017multi}.
 An earlier empirical study of GitHub shows that using more languages to implement a project has a significant effect on project quality, since it increases defects~\citep{kochhar2016large}.
 A study of \gls{IOT} stack developers found that interoperation poses a real challenge, that microservices blur the abstraction between tiers, and that both testing and scaling \gls{IOT} applications to more devices are hard~\citep{motta2018challenges}.
 
 One way of minimising the challenges of developing tiered polyglot \gls{IOT} software is to standardise and reuse components. This approach has been hugely successful for web stacks, e.g.\ browser standards. The W3C
-Web of Things aims to facilitate re-use by providing standardised metadata and other re-usable technological \gls{IOT} building blocks~\citep{guinard_building_2016}.  However, the Web of Things has yet to gain widespread adoption. Moreover, as it is based on web technology, it requires the \emph{thing} to run a web server, significantly increasing the hardware requirements.
+Web of Things aims to facilitate re-use by providing standardised metadata and other re-usable technological \gls{IOT} building blocks~\citep{guinard_building_2016}. However, the Web of Things has yet to gain widespread adoption. Moreover, as it is based on web technology, it requires the \emph{thing} to run a web server, significantly increasing the hardware requirements.
 
 \section{Tierless languages}%
 \label{sec_t4t:TiredvsTierless}
 
-A radical approach to overcoming the challenges raised by tiered distributed software is to use a tierless programming language that eliminates the semantic friction between tiers by generating code for all tiers, and all communication between  tiers, from a single program. 
+A radical approach to overcoming the challenges raised by tiered distributed software is to use a tierless programming language that eliminates the semantic friction between tiers by generating code for all tiers, and all communication between tiers, from a single program. 
 %\adriancomment{Also referred to as multi-tier programming, tierless language applications usually utilise a single language, paradigm and type system, and the entire system is simultaneously checked by the compiler~\citep{weisenburger2020survey}.}
 Typically a tierless program uses a single language, paradigm and type system, and the entire distributed system is simultaneously checked by the compiler.
 
@@ -178,18 +170,18 @@ There are established tierless languages for web development, both standalone la
 Example standalone tierless web languages are Links~\citep{cooper2006links} and Hop~\citep{serrano2006hop}.
 From a single declarative program the client, server and database code is simultaneously checked by the compiler, and compiled to the required component languages. For example, Links compiles to HTML and JavaScript for the client side and to SQL on the server-side to interact with the database system.
 
-An example tierless web framework that uses a \gls{DSL} is  Haste~\citep{10.1145/2775050.2633367},  that embeds the \gls{DSL} in \gls{HASKELL}. Haste programs are compiled multiple times: the server code is generated by the standard \gls{GHC} \gls{HASKELL} compiler~\citep{hall1993glasgow}; Javascript for the client is generated by a custom \gls{GHC} compiler backend. The design leverages \gls{HASKELL}'s high-level programming abstractions and strong typing, and benefits from \gls{GHC}: a mature and sophisticated compiler.
+An example tierless web framework that uses a \gls{DSL} is Haste~\citep{10.1145/2775050.2633367}, that embeds the \gls{DSL} in \gls{HASKELL}. Haste programs are compiled multiple times: the server code is generated by the standard \gls{GHC} \gls{HASKELL} compiler~\citep{hall1993glasgow}; Javascript for the client is generated by a custom \gls{GHC} compiler backend. The design leverages \gls{HASKELL}'s high-level programming abstractions and strong typing, and benefits from \gls{GHC}: a mature and sophisticated compiler.
 
 
 \subsection{Tierless \texorpdfstring{\gls{IOT}}{IoT} languages}
 The use of tierless languages in \gls{IOT} applications is both more recent and less common than for web applications.
 Tierless \gls{IOT} programming may extend tierless web programming by adding network and perception layers.
-The presentation layer of a tierless \gls{IOT} language, like tierless web languages, benefits from almost invariably executing in a standard browser. The perception layer faces greater challenges, often executing on one of a set of slow and resource-constrained microcontrollers. Hence, tierless \gls{IOT} languages typically compile the perception layer to either \gls{C}\slash\gls{CPP} (the lingua franca of microcontrollers), or to some intermediate representation to be interpreted.
+The presentation layer of a tierless \gls{IOT} language, like tierless web languages, benefits from almost invariably executing in a standard browser. The perception layer faces greater challenges, often executing on one of a set of slow and resource-constrained microprocessors. Hence, tierless \gls{IOT} languages typically compile the perception layer to either \gls{C}\slash\gls{CPP} (the lingua franca of microcontrollers), or to some intermediate representation to be interpreted.
 
-\subsubsection{\texorpdfstring{\Glspl{DSL}}{DSLs} for microcontrollers}
-Many \glspl{DSL} provide high-level programming for microcontrollers, for example providing strong typing and memory safety.
+\subsubsection{\texorpdfstring{\Glspl{DSL}}{DSLs} for microprocessors}
+Many \glspl{DSL} provide high-level programming for microprocessors, for example providing strong typing and memory safety.
 For example Copilot~\citep{hess_arduino-copilot_2020}
-and Ivory~\citep{elliott_guilt_2015} are imperative \glspl{DSL} embedded in a functional language that compile to \gls{C}\slash\gls{CPP}.  In contrast to  \gls{CLEAN}/\gls{ITASK}/\gls{MTASK} such \glspl{DSL} are not tierless \gls{IOT} languages as they have no automatic integration with the server, i.e.\ with the application and presentation layers.
+and Ivory~\citep{elliott_guilt_2015} are imperative \glspl{DSL} embedded in a functional language that compile to \gls{C}\slash\gls{CPP}. In contrast to \gls{CLEAN}/\gls{ITASK}/\gls{MTASK} such \glspl{DSL} are not tierless \gls{IOT} languages as they have no automatic integration with the server, i.e.\ with the application and presentation layers.
 
 
 \subsubsection{\texorpdfstring{\Gls{FRP}}{Functional reactive programming}}
@@ -204,7 +196,7 @@ TOP allows for more complex collaboration patterns than \gls{FRP}~\citep{wang_ma
 \subsubsection{Erlang/Elixir \texorpdfstring{\gls{IOT}}{IoT} systems}
 A number of production \gls{IOT} systems are engineered in Erlang or Elixir, and many are mostly tierless.
 That is the perception, network and application layers are sets of distributed Erlang processes, although the presentation layer typically uses some conventional web technology.
-A resource-rich sensor node may support many Erlang processes on an Erlang VM, or low level code (typically \gls{C}\slash\gls{CPP}) on a resource-constrained microcontroller can emulate an Erlang process.
+A resource-rich sensor node may support many Erlang processes on an Erlang VM, or low level code (typically \gls{C}\slash\gls{CPP}) on a resource-constrained microprocessor can emulate an Erlang process.
 Only a small fraction of these systems are described in the academic literature, example exceptions are~\citep{sivieri2012drop,shibanai_distributed_2018}, with many described only in grey literature or not at all.
 
 \subsection{Characteristics of tierless \texorpdfstring{\gls{IOT}}{IoT} languages}%
@@ -215,26 +207,26 @@ This study compares a pair of tierless \gls{IOT} languages with conventional tie
 \subsubsection{Program splitting}
 
 A key challenge for an automatically segmented tierless language is to determine which parts of the program correspond to a particular tier and hence should be executed by a specific component on a specific host, so-called tier splitting.
-For example a tierless web language must identify client code to ship to browsers, database code to execute in the DBMS, and application code to run on the server. Some tierless languages split programs using types, others use syntactic markers, e.g.\ pragmas  like \cleaninline{server} or \cleaninline{client}, to split the program~\citep{cooper2006links,10.1145/2775050.2633367}. It may be possible to infer the splitting between tiers, relieving the developers from the need specify it, as illustrated for Javascript as a tierless web language~\citep{10.1145/2661136.2661146}.
+For example a tierless web language must identify client code to ship to browsers, database code to execute in the DBMS, and application code to run on the server. Some tierless languages split programs using types, others use syntactic markers, e.g.\ pragmas like \cleaninline{server} or \cleaninline{client}, to split the program~\citep{cooper2006links,10.1145/2775050.2633367}. It may be possible to infer the splitting between tiers, relieving the developers from the need specify it, as illustrated for Javascript as a tierless web language~\citep{10.1145/2661136.2661146}.
 
 In \gls{CLEAN}\slash\gls{ITASK}/\gls{MTASK} and \gls{CLEAN}/\gls{ITASK} tier splitting is specified by functions, and hence is a first-class language construct.
-For example in \gls{CLEAN}\slash\gls{ITASK} the \cleaninline{asyncTask}  function identifies a task for execution on a remote device and \cleaninline{liftmTask} executes the given task on an \gls{IOT} device. The tier splitting functions are illustrated in examples in the next section, e.g.\ on \cref{lst_t4t:itaskTempFull:startdevtask} in \cref{lst_t4t:itaskTempFull} and \cref{lst_t4t:mtaskTemp:liftmtask} in \cref{lst_t4t:mtaskTemp}.
+For example in \gls{CLEAN}\slash\gls{ITASK} the \cleaninline{asyncTask} function identifies a task for execution on a remote device and \cleaninline{liftmTask} executes the given task on an \gls{IOT} device. The tier splitting functions are illustrated in examples in the next section, e.g.\ on \cref{lst_t4t:itaskTempFull:startdevtask} in \cref{lst_t4t:itaskTempFull} and \cref{lst_t4t:mtaskTemp:liftmtask} in \cref{lst_t4t:mtaskTemp}.
 Specifying splitting as functions means that new splitting functions can be composed, and that splitting is under program control, e.g.\ during execution a program can decide to run a task locally or remotely.
 
 \subsubsection{Communication}\label{ssec_t4t:communication}
 
-Tierless languages may adopt a range of communication paradigms for communicating between components. Different tierless languages specify communication in different ways~\citep{weisenburger2020survey}. Remote procedures are the most common communication mechanism: a procedure/function executing on a remote host/machine is called as if it was local. The communication of the arguments to, and the results from, the remote procedure is automatically provided by the language implementation.  Other mechanisms include explicit message passing between components; publish/subscribe where components subscribe to topics of interest from other components; reactive programming defines event streams between remote components; finally shared state makes changes in a shared and potentially remote data structure visible to components.
+Tierless languages may adopt a range of communication paradigms for communicating between components. Different tierless languages specify communication in different ways~\citep{weisenburger2020survey}. Remote procedures are the most common communication mechanism: a procedure/function executing on a remote host/machine is called as if it was local. The communication of the arguments to, and the results from, the remote procedure is automatically provided by the language implementation. Other mechanisms include explicit message passing between components; publish/subscribe where components subscribe to topics of interest from other components; reactive programming defines event streams between remote components; finally shared state makes changes in a shared and potentially remote data structure visible to components.
 
 \Gls{CLEAN}\slash\gls{ITASK}/\gls{MTASK} and \gls{CLEAN}/\gls{ITASK} communicate using a combination of remote task invocation, similar to remote procedures, and shared state through \glspl{SDS}.
-\Cref{lst_t4t:itaskTempFull} illustrates: \cref{lst_t4t:itaskTempFull:startdevtask} shows a server task launching  a remote task, \cleaninline{devTask}, on to a sensor node; and \cref{lst_t4t:itaskTempFull:remoteShare} shows the sharing of the remote \cleaninline{latestTemp} \gls{SDS}.
+\Cref{lst_t4t:itaskTempFull} illustrates: \cref{lst_t4t:itaskTempFull:startdevtask} shows a server task launching a remote task, \cleaninline{devTask}, on to a sensor node; and \cref{lst_t4t:itaskTempFull:remoteShare} shows the sharing of the remote \cleaninline{latestTemp} \gls{SDS}.
 %\mlcomment{I think this is fine}
 
 \subsubsection{Placement}
 
-In many \gls{IOT} systems the sensor nodes are microcontrollers that are programmed by writing the program to flash memory. This means that without extra effort, physical access to the microcontroller is needed to change the program making updates challenging.
+In many \gls{IOT} systems the sensor nodes are microprocessors that are programmed by writing the program to flash memory. This means that without extra effort, physical access to the microcontroller is needed to change the program making updates challenging.
 Hence, most \gls{IOT} systems compile sensor node code directly for the target architecture or via an existing language such as \gls{C}\slash\gls{CPP}.
 
-Techniques such as over-the-air programming and interpreters allow microcontrollers to be dynamically provisioned, increasing their maintainability and resilience.
+Techniques such as over-the-air programming and interpreters allow microprocessors to be dynamically provisioned, increasing their maintainability and resilience.
 For example Baccelli et al.\ provide a single language \gls{IOT} system based on the RIOT \gls{OS} that allows runtime deployment of code snippets called containers~\citep{baccelli_reprogramming_2018}.
 Both client and server are written in JavaScript. However, there is no integration between the client and the server other than that they are programmed from a single source.
 Mat\`e is an example of an early tierless sensor network framework where devices are provided with a virtual machine using TinyOS for dynamic provisioning~\citep{levis_mate_2002}.
@@ -251,15 +243,15 @@ Placement happens automatically as part of the first-class splitting constructs
 
 \subsubsection{Security}
 
-Security is a major issue and a considerable challenge for many \gls{IOT} systems~\citep{10.1145/3437537}. There are potentially security issues at each layer in an \gls{IOT} application (\cref{fig_t4t:iot_arch}). The security issues and defence mechanisms at the application and presentation layers are relatively standard, e.g.\ defending against SQL injection attacks. The security issues at the network and perception layers are more challenging. Resource-rich sensor nodes can adopt some standard security measures like encrypting messages, and regularly applying software patches to the operating system. However microcontrollers often lack the computational resources for encryption, and it is hard to patch their system software because the program is often stored in flash memory. In consequence there are infamous examples of \gls{IOT} systems being hijacked to create botnets~\citep{203628,herwig_measurement_2019}.
+Security is a major issue and a considerable challenge for many \gls{IOT} systems~\citep{10.1145/3437537}. There are potentially security issues at each layer in an \gls{IOT} application (\cref{fig_t4t:iot_arch}). The security issues and defence mechanisms at the application and presentation layers are relatively standard, e.g.\ defending against SQL injection attacks. The security issues at the network and perception layers are more challenging. Resource-rich sensor nodes can adopt some standard security measures like encrypting messages, and regularly applying software patches to the operating system. However microprocessors often lack the computational resources for encryption, and it is hard to patch their system software because the program is often stored in flash memory. In consequence there are infamous examples of \gls{IOT} systems being hijacked to create botnets~\citep{203628,herwig_measurement_2019}.
 
 Securing the entire stack in a conventional tiered \gls{IOT} application is particularly challenging as the stack is implemented in a collection of programming languages with low level programming and communication abstractions. In such polyglot distributed systems it is hard to determine, and hence secure, the flow of data between components. In consequence a small mistake may have severe security implications. 
 
-A number of characteristics of tierless languages help to improve security. Communication and placement vulnerabilities are minimised as communication and placement are automatically generated and checked by the compiler.  So injection attacks and the exploitation of communication/placement protocol bugs are less likely. Vulnerabilities introduced by mismatched types are avoided as the entire system is type checked. Moreover, tierless languages can exploit language level security techniques. For example  languages like Jif/split~\citep{zdancewic2002secure} and Swift~\citep{chong2007secure} place components to protect the security of data. Another example are programming language technologies for controlling information flow, and these can be used to improve security. For example Haski uses them to improve the security of \gls{IOT} systems~\citep{valliappan_towards_2020}. 
+A number of characteristics of tierless languages help to improve security. Communication and placement vulnerabilities are minimised as communication and placement are automatically generated and checked by the compiler. So injection attacks and the exploitation of communication/placement protocol bugs are less likely. Vulnerabilities introduced by mismatched types are avoided as the entire system is type checked. Moreover, tierless languages can exploit language level security techniques. For example languages like Jif/split~\citep{zdancewic2002secure} and Swift~\citep{chong2007secure} place components to protect the security of data. Another example are programming language technologies for controlling information flow, and these can be used to improve security. For example Haski uses them to improve the security of \gls{IOT} systems~\citep{valliappan_towards_2020}. 
 
 However many tierless languages have yet to provide a comprehensive set of security technologies, despite its importance in domains like web and \gls{IOT} applications. For example Erlang and many Erlang-based systems~\citep{shibanai_distributed_2018,sivieri2012drop}, lack important security measures. Indeed security is not covered in a recent, otherwise comprehensive, survey of tierless technologies~\citep{weisenburger2020survey}.
 
-\Gls{CLEAN}\slash\gls{ITASK} and \gls{CLEAN}/\gls{ITASK}/\gls{MTASK} are typical in this respect: little effort has yet been expended on improving their security. Of course as tierless languages they  benefit from static type safety and automatically generated communication and placement. Some preliminary work shows that, as the communication between layers is protocol agnostic, more secure alternatives can be used. One example is to run the \gls{ITASK} server behind a reverse proxy implementing TLS/SSL encryption~\citep{wijkhuizen_security_2018}. A second is to add  integrity checks or even encryption to the communication protocol for resource-rich sensor nodes~\citep{boer_de_secure_2020}.
+\Gls{CLEAN}\slash\gls{ITASK} and \gls{CLEAN}/\gls{ITASK}/\gls{MTASK} are typical in this respect: little effort has yet been expended on improving their security. Of course as tierless languages they benefit from static type safety and automatically generated communication and placement. Some preliminary work shows that, as the communication between layers is protocol agnostic, more secure alternatives can be used. One example is to run the \gls{ITASK} server behind a reverse proxy implementing TLS/SSL encryption~\citep{wijkhuizen_security_2018}. A second is to add integrity checks or even encryption to the communication protocol for resource-rich sensor nodes~\citep{boer_de_secure_2020}.
 
 \section{Task-oriented and \texorpdfstring{\gls{IOT}}{IoT} programming in \texorpdfstring{\gls{CLEAN}}{Clean}}
 
@@ -268,11 +260,11 @@ To make this paper self-contained we provide a concise overview of \gls{CLEAN},
 \Gls{CLEAN} is a statically typed functional programming language similar to \gls{HASKELL}: both languages are pure and non-strict~\citep{achten_clean_2007}.
 A key difference is how state is handled: \gls{HASKELL} typically embeds stateful actions in the \haskellinline{IO} Monad~\citep{peyton_jones_imperative_1993,wiki:IO}.
 In contrast, \gls{CLEAN} has a uniqueness type system to ensure the single-threaded use of stateful objects like files and windows~\citep{barendsen_smetsers_1996}.
-Both \gls{CLEAN} and \gls{HASKELL} support fairly similar models of generic programming~\citep{ComparingGenericProgramming}, enabling functions to work on many types. As we shall see generic programming is heavily used in task-oriented programming~\citep{GenericProgrammingExtensionForClean,HinzeGenericFunctionalProgramming},  for example to construct web editors and communication protocols that work for any user-defined datatype.
+Both \gls{CLEAN} and \gls{HASKELL} support fairly similar models of generic programming~\citep{ComparingGenericProgramming}, enabling functions to work on many types. As we shall see generic programming is heavily used in task-oriented programming~\citep{GenericProgrammingExtensionForClean,HinzeGenericFunctionalProgramming}, for example to construct web editors and communication protocols that work for any user-defined datatype.
 
 \subsection{\texorpdfstring{\Acrlong{TOP}}{Task-oriented programming}}
 
-\Gls{TOP} is a declarative programming paradigm for  constructing interactive distributed systems~\citep{plasmeijer_task-oriented_2012}.
+\Gls{TOP} is a declarative programming paradigm for constructing interactive distributed systems~\citep{plasmeijer_task-oriented_2012}.
 Tasks are the basic blocks of \gls{TOP} and represent work that needs to be done in the broadest sense.
 Examples of typical tasks range from allowing a user to complete a form, controlling peripherals, moderating other tasks, or monitoring a database.
 From a single declarative description of tasks all of the required software components are generated.
@@ -281,13 +273,13 @@ That is, from a single \gls{TOP} program the language implementation automatical
 Application areas range from simple web forms or blinking \glspl{LED} to multi-user distributed collaboration between people and machines~\citep{oortgiese_distributed_2017}.
 
 
-\Gls{TOP} adds three concepts: tasks, task combinators, and \glspl{SDS}. Example basic tasks are web editors for user-defined datatypes, reading some \gls{IOT} sensor,  or controlling peripherals like a servo motor.
+\Gls{TOP} adds three concepts: tasks, task combinators, and \glspl{SDS}. Example basic tasks are web editors for user-defined datatypes, reading some \gls{IOT} sensor, or controlling peripherals like a servo motor.
 Task combinators compose tasks into more advanced tasks, either in parallel or sequential and allow task values to be observed by other tasks.
 As tasks can be returned as the result of a function, recursion can be freely used, e.g.\ to express the repetition of tasks.
 There are also standard combinators for common patterns.
 Tasks can exchange information via \glspl{SDS}~\citep{ParametricLenses}.
 All tasks involved can atomically observe and change the value of a typed \gls{SDS}, allowing more flexible communication than with task combinators.
-\glspl{SDS} offer a general abstraction of data shared by different tasks, analogous to variables, persistent values, files, databases and peripherals like sensors. Combinators  compose \glspl{SDS} into a larger \gls{SDS}, and
+\glspl{SDS} offer a general abstraction of data shared by different tasks, analogous to variables, persistent values, files, databases and peripherals like sensors. Combinators compose \glspl{SDS} into a larger \gls{SDS}, and
 parametric lenses define a specific view on an \gls{SDS}.
 
 
@@ -296,11 +288,11 @@ parametric lenses define a specific view on an \gls{SDS}.
 \label{sec_t4t:itasks}
 
 
-The \gls{ITASK} \gls{EDSL} is designed for constructing multi-user distributed  applications, including web~\citep{TOP-ICFP07} or \gls{IOT} applications.
+The \gls{ITASK} \gls{EDSL} is designed for constructing multi-user distributed applications, including web~\citep{TOP-ICFP07} or \gls{IOT} applications.
 Here we present \gls{ITASK} by example, and the first is a complete program to repeatedly read the room temperature from a digital humidity and temperature (DHT) sensor attached to the machine and display it on a web page (\cref{lst_t4t:itaskTemp}).
 The first line is the module name, the third imports the \cleaninline{iTask} module, and the main function (\cref{lst_t4t:itaskTemp:systemfro,lst_t4t:itaskTemp:systemto}) launches \cleaninline{readTempTask} and the \gls{ITASK} system to generate the web interface in \cref{fig_t4t:itaskTempSimple}.
 
-Interaction with a device like the DHT sensor using a protocol like 1-Wire or gls{I2C} is abstracted into a library. So the \cleaninline{readTempTask} task starts by creating a \cleaninline{dht} sensor object (\cref{lst_t4t:itaskTemp:dhtDef}) thereafter \cleaninline{repeatEvery}  executes a task at the specified \cleaninline{interval}. This task reads the temperature from the \cleaninline{dht} sensor, and with a sequential composition combinator \cleaninline{>>~} passes the \cleaninline{temp} value to \cleaninline{viewInformation} that displays it on the web page (\cref{lst_t4t:itaskTemp:viewInformation}).
+Interaction with a device like the DHT sensor using a protocol like 1-Wire or gls{I2C} is abstracted into a library. So the \cleaninline{readTempTask} task starts by creating a \cleaninline{dht} sensor object (\cref{lst_t4t:itaskTemp:dhtDef}) thereafter \cleaninline{repeatEvery} executes a task at the specified \cleaninline{interval}. This task reads the temperature from the \cleaninline{dht} sensor, and with a sequential composition combinator \cleaninline{>>~} passes the \cleaninline{temp} value to \cleaninline{viewInformation} that displays it on the web page (\cref{lst_t4t:itaskTemp:viewInformation}).
 The tuning combinator \cleaninline{<<@} adds a label to the web editor displaying the temperature. Crucially, the \gls{ITASK} implementation transparently ships parts of the code for the web-interface to be executed in the browser, and \cref{fig_t4t:itaskTempSimple} shows the UML deployment diagram.
 
 \begin{lstClean}[%
@@ -316,12 +308,12 @@ Start world = doTasks readTempTask world [+\label{lst_t4t:itaskTemp:systemto}+]
 
 readTempTask :: Task Real
 readTempTask =
-    withDHT IIO_TempID \dht ->       [+\label{lst_t4t:itaskTemp:dhtDef}+]
-    repeatEvery interval (          [+\label{lst_t4t:itaskTemp:repeat}+]
-        temperature dht >>~ \temp -> [+\label{lst_t4t:itaskTemp:readDHT}+]
-        viewInformation [] temp <<@ [+\label{lst_t4t:itaskTemp:viewInformation}+]
-        Label "Temperature"         [+\label{lst_t4t:itaskTemp:label}+]
-    )
+       withDHT IIO_TempID \dht ->       [+\label{lst_t4t:itaskTemp:dhtDef}+]
+       repeatEvery interval (          [+\label{lst_t4t:itaskTemp:repeat}+]
+               temperature dht >>~ \temp -> [+\label{lst_t4t:itaskTemp:readDHT}+]
+               viewInformation [] temp <<@ [+\label{lst_t4t:itaskTemp:viewInformation}+]
+               Label "Temperature"         [+\label{lst_t4t:itaskTemp:label}+]
+       )
 \end{lstClean}
 
 \begin{figure}[ht]
@@ -340,7 +332,7 @@ readTempTask =
        \label{fig_t4t:itaskTempSimple}
 \end{figure}
 
-SimpleTempSensor only reports instantaneous temperature measurements. Extending it to store and manipulate timed temperature records produces a tiny tierless web application: TempHistory in \cref{lst_t4t:TempHistory}. A tierless \gls{IOT} system can be controlled from a web interface in exactly the same way, e.g.\ to view and set the measurement frequencies of each of the room sensors. \Cref{lst_t4t:itaskTemp:Measurement} defines a record to store  \cleaninline{time} and \cleaninline{temp} measurements. Task manipulations are derived for \cleaninline{Measurement} (\cref{lst_t4t:itaskTemp:derive}) and these include displaying measurements in a web-editor and storing them in a file.
+SimpleTempSensor only reports instantaneous temperature measurements. Extending it to store and manipulate timed temperature records produces a tiny tierless web application: TempHistory in \cref{lst_t4t:TempHistory}. A tierless \gls{IOT} system can be controlled from a web interface in exactly the same way, e.g.\ to view and set the measurement frequencies of each of the room sensors. \Cref{lst_t4t:itaskTemp:Measurement} defines a record to store \cleaninline{time} and \cleaninline{temp} measurements. Task manipulations are derived for \cleaninline{Measurement} (\cref{lst_t4t:itaskTemp:derive}) and these include displaying measurements in a web-editor and storing them in a file.
 \Cref{lst_t4t:itaskTemp:measurementsSDS} defines a persistent \gls{SDS} to store a list of measurements, and for communication between tasks. The \gls{SDS} is analogous to the SQL DBMS in many tiered web applications.
 
 TempHistory defines two tasks that interact with the \texttt{mea\-sure\-ments\-SDS}: \texttt{mea\-sure\-Task} adds measurements at each detected change in the temperature.
@@ -354,7 +346,7 @@ On \cref{lst_t4t:itaskTemp:launch} \cleaninline{task} is launched with an initia
 \begin{lstClean}[%
        numbers=left,
        caption={TempHistory: a tierless \gls{CLEAN}\slash\gls{ITASK} webapplication that records and manipulates timed temperatures},
-    label={lst_t4t:TempHistory}]
+       label={lst_t4t:TempHistory}]
 module TempHistory
 
 import iTasks, iTasks.Extensions.DateTime
@@ -367,7 +359,7 @@ measurementsSDS = sharedStore "measurements" []
 
 measureTask :: Task () [+\label{lst_t4t:itaskTemp:measureTask}+]
 measureTask =
-    withDHT IIO_TempID \dht ->
+       withDHT IIO_TempID \dht ->
        let task old =
                        temperature dht >>* [+\label{lst_t4t:itaskTemp:step}+]
                        [ OnValue (ifValue ((<>) old) \temp -> [+\label{lst_t4t:itaskTemp:action1}+]
@@ -401,8 +393,8 @@ mainTask = controlSDS False -|| measureTask
 The \cleaninline{controlSDS} task illustrates communication from the web page user and persistent data manipulation. That is, it generates a web page that allows users to control their view of the temperature measurements, as illustrated in \cref{fig_t4t:TempHistory}. The page contains
 \begin{enumerate*}
        \item a web editor to enter the number \cleaninline{n} of elements to display, generated on \cref{lst_t4t:itaskTemp:enter}.
-       \item A display of the  \cleaninline{n} most recent temperature and time measurements, \crefrange{lst_t4t:itaskTemp:view}{lst_t4t:itaskTemp:viewend}.
-       \item Three buttons that are again combined with the step combinator \cleaninline{>>*}, \crefrange{lst_t4t:itaskTemp:viewend}{lst_t4t:itaskTemp:actionend}. The \cleaninline{Clear} button is \cleaninline{always} enabled and sets the \gls{SDS} to an empty list before calling \cleaninline{controlSDS} recursively. The \cleaninline{Take} button is only enabled when the web editor produces a positive \cleaninline{n} and updates the  \cleaninline{measurementsSDS} with the \cleaninline{n}  most recent measurements  before calling \cleaninline{controlSDS} recursively. The final action is \cleaninline{always} enabled and calls \cleaninline{controlSDS} recursively with the negation of the \cleaninline{byTemp} argument to change the sorting criteria.
+       \item A display of the \cleaninline{n} most recent temperature and time measurements, \crefrange{lst_t4t:itaskTemp:view}{lst_t4t:itaskTemp:viewend}.
+       \item Three buttons that are again combined with the step combinator \cleaninline{>>*}, \crefrange{lst_t4t:itaskTemp:viewend}{lst_t4t:itaskTemp:actionend}. The \cleaninline{Clear} button is \cleaninline{always} enabled and sets the \gls{SDS} to an empty list before calling \cleaninline{controlSDS} recursively. The \cleaninline{Take} button is only enabled when the web editor produces a positive \cleaninline{n} and updates the \cleaninline{measurementsSDS} with the \cleaninline{n} most recent measurements before calling \cleaninline{controlSDS} recursively. The final action is \cleaninline{always} enabled and calls \cleaninline{controlSDS} recursively with the negation of the \cleaninline{byTemp} argument to change the sorting criteria.
 \end{enumerate*}
 
 \begin{figure}[ht]
@@ -418,7 +410,7 @@ The \cleaninline{controlSDS} task illustrates communication from the web page us
                \caption{Web page sorted by temperature.}
        \end{subfigure}
        \caption{Web pages generated by the \cleaninline{TempHistory} \gls{CLEAN}\slash\gls{ITASK} tierless web application.
-           The \cleaninline{Take} button is only enabled when the topmost editor contains a positive number.
+               The \cleaninline{Take} button is only enabled when the topmost editor contains a positive number.
        }%
        \label{fig_t4t:TempHistory}
 \end{figure}
@@ -435,10 +427,10 @@ The \cleaninline{controlSDS} task illustrates communication from the web page us
 \subsection{Engineering tierless \texorpdfstring{\gls{IOT}}{IoT} systems with \texorpdfstring{\gls{ITASK}}{iTask}}%
 \label{sec_t4t:itaskIOT}
 
-A typical \gls{IOT} system goes beyond a web application by incorporating a distributed set of sensor nodes each with a collection of sensors or actuators. That is, they add the perception and network layers in \cref{fig_t4t:iot_arch}.  If the sensor nodes have the computational resources to support an \gls{ITASK} server, as a Raspberry Pi does, then \gls{ITASK} can also be used to implement these layers, and integrate them with the application and presentation layers tierlessly.
+A typical \gls{IOT} system goes beyond a web application by incorporating a distributed set of sensor nodes each with a collection of sensors or actuators. That is, they add the perception and network layers in \cref{fig_t4t:iot_arch}. If the sensor nodes have the computational resources to support an \gls{ITASK} server, as a Raspberry Pi does, then \gls{ITASK} can also be used to implement these layers, and integrate them with the application and presentation layers tierlessly.
 
 As an example of tierless \gls{IOT} programming in \gls{CLEAN}\slash\gls{ITASK} \cref{lst_t4t:itaskTempFull} shows a complete temperature sensing system with a server and a single sensor node (\gls{CRTS}), omitting only the module name and imports.
-It is similar to the SimpleTempSensor and TempHistory programs above, for example \cleaninline{devTask} repeatedly sleeps and records temperatures and times, and \cleaninline{mainTask} displays the temperatures on  the web page  in \cref{fig_t4t:cwtsweb}. There are some important differences, however. The \cleaninline{devTask} (\crefrange{lst_t4t:itaskTempFull:sensorfro}{lst_t4t:itaskTempFull:sensorto}) executes on the sensor node and records the temperatures in a standard timestamped (lens on) an \gls{SDS}: \cleaninline{dateTimeStampedShare} \cleaninline{latestTemp}.
+It is similar to the SimpleTempSensor and TempHistory programs above, for example \cleaninline{devTask} repeatedly sleeps and records temperatures and times, and \cleaninline{mainTask} displays the temperatures on the web page in \cref{fig_t4t:cwtsweb}. There are some important differences, however. The \cleaninline{devTask} (\crefrange{lst_t4t:itaskTempFull:sensorfro}{lst_t4t:itaskTempFull:sensorto}) executes on the sensor node and records the temperatures in a standard timestamped (lens on) an \gls{SDS}: \cleaninline{dateTimeStampedShare} \cleaninline{latestTemp}.
 The \cleaninline{mainTask} (\cref{lst_t4t:itaskTempFull:main}) executes on the server: it starts \cleaninline{devTask} as an asynchronous task on the specified sensor node (\cref{lst_t4t:itaskTempFull:startdevtask}) and then generates a web page to display the latest temperature and time (\cref{lst_t4t:itaskTempFull:displaystart,lst_t4t:itaskTempFull:displayend}).
 
 The \cleaninline{tempSDS} is very similar to the \cleaninline{measurementsSDS} from the previous listings.
@@ -451,9 +443,9 @@ The result of reading is the head of the list, if it exists.
 The type for writing \cleaninline{latestTemp} is a tuple with a new \cleaninline{DateTime} and temperature as \cleaninline{Real}.
 
 \begin{lstClean}[%
-    numbers=left,
+       numbers=left,
        caption={\gls{CRTS}: a tierless temperature sensing \gls{IOT} system. Written in \gls{CLEAN}\slash\gls{ITASK}, it targets a resource-rich sensor node.},
-    label={lst_t4t:itaskTempFull}]
+       label={lst_t4t:itaskTempFull}]
 tempSDS :: SimpleSDSLens [(DateTime, Real)]
 tempSDS = sharedStore "temperatures" []
 
@@ -489,32 +481,32 @@ mainTask [+\label{lst_t4t:itaskTempFull:main}+]
                \caption{Deployment diagram.}
        \end{subfigure}
        \caption{Tierless \gls{ITASK} \gls{CRTS} temperature sensing \gls{IOT} system.}%
-    \label{fig_t4t:cwtsweb}
+       \label{fig_t4t:cwtsweb}
 \end{figure}
 
 \subsection{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\gls{EDSL}}{eDSL}}%
 \label{sec_t4t:mtasks}
 
-In many \gls{IOT} systems the sensor nodes are resource constrained, e.g.\ inexpensive microcontrollers. These are far cheaper, and consume far less power, than a single-board computer like a Raspberry Pi. Microcontrollers also allow the programmer to easily control peripherals like sensors and actuators via the \gls{IO} pins of the processor.
+In many \gls{IOT} systems the sensor nodes are resource constrained, e.g.\ inexpensive microprocessors. These are far cheaper, and consume far less power, than a single-board computer like a Raspberry Pi. Microprocessors also allow the programmer to easily control peripherals like sensors and actuators via the \gls{IO} pins of the processor.
 
-Microcontrollers have limited memory capacity, compute power and communication bandwidth, and hence typically no \gls{OS}.
+Microprocessors have limited memory capacity, compute power and communication bandwidth, and hence typically no \gls{OS}.
 These limitations make it impossible to run an \gls{ITASK} server:
-there is no \gls{OS} to start the remote task, the code of the task is too big to fit in the available memory and the microcontroller processor is too slow to run it.
-The \gls{MTASK} \gls{EDSL} is designed to bridge this gap: \gls{MTASK} tasks can be communicated from the server to the sensor node, to execute within the limitations of a typical microcontroller, while providing programming abstractions that are consistent with \gls{ITASK}.
+there is no \gls{OS} to start the remote task, the code of the task is too big to fit in the available memory and the microprocessor processor is too slow to run it.
+The \gls{MTASK} \gls{EDSL} is designed to bridge this gap: \gls{MTASK} tasks can be communicated from the server to the sensor node, to execute within the limitations of a typical microprocessor, while providing programming abstractions that are consistent with \gls{ITASK}.
 
 Like \gls{ITASK}, \gls{MTASK} is task oriented, e.g.\ there are primitive tasks that produce intermediate values, a restricted set of task combinators to compose the tasks, and (recursive) functions to construct tasks.
 \Gls{MTASK} tasks communicate using task values or \glspl{SDS} that may be local or remote, and may be shared by some \gls{ITASK} tasks.
 
-Apart from the \gls{EDSL}, the \gls{MTASK} system contains a featherlight domain-specific \emph{operating system} running on the microcontroller.
-This \gls{OS} task scheduler receives the byte code generated from one or more \gls{MTASK} programs and interleaves the execution of those tasks. The \gls{OS} also manages \gls{SDS} updates  and the passing of task results.
-The \gls{MTASK} \gls{OS} is stored in flash memory while the tasks are stored in \gls{RAM} to minimise wear on the flash memory. While sending byte code to a sensor node at runtime greatly increases the amount of communication, this can be mitigated as any tasks known at compile time can be preloaded on the microcontroller.
-In contrast, compiled programs, like \gls{C}\slash\gls{CPP}, are stored in flash memory and there can only ever be a few thousand programs uploaded during the lifetime of the microcontroller before exhausting the flash memory. 
+Apart from the \gls{EDSL}, the \gls{MTASK} system contains a featherlight domain-specific \emph{operating system} running on the microprocessor.
+This \gls{OS} task scheduler receives the byte code generated from one or more \gls{MTASK} programs and interleaves the execution of those tasks. The \gls{OS} also manages \gls{SDS} updates and the passing of task results.
+The \gls{MTASK} \gls{OS} is stored in flash memory while the tasks are stored in \gls{RAM} to minimise wear on the flash memory. While sending byte code to a sensor node at runtime greatly increases the amount of communication, this can be mitigated as any tasks known at compile time can be preloaded on the microprocessor.
+In contrast, compiled programs, like \gls{C}\slash\gls{CPP}, are stored in flash memory and there can only ever be a few thousand programs uploaded during the lifetime of the microprocessor before exhausting the flash memory. 
 
 \subsection{Engineering tierless \texorpdfstring{\gls{IOT}}{IoT} systems with \texorpdfstring{\gls{MTASK}}{mTask}}%
 \label{sec_t4t:mtaskIOT}
 
-A tierless \gls{CLEAN} \gls{IOT} system with microcontroller sensor nodes integrates a set of \gls{ITASK} tasks that specify the application and presentation layers with a set of \gls{MTASK}s that specify the perception and network layers.
-We illustrate with \gls{CWTS}: a simple room temperature sensor with a web display. \gls{CWTS} is equivalent to the \gls{ITASK} \gls{CRTS} (\cref{lst_t4t:itaskTempFull}), except that the sensor node is a Wemos microcontroller.
+A tierless \gls{CLEAN} \gls{IOT} system with microprocessor sensor nodes integrates a set of \gls{ITASK} tasks that specify the application and presentation layers with a set of \gls{MTASK}s that specify the perception and network layers.
+We illustrate with \gls{CWTS}: a simple room temperature sensor with a web display. \gls{CWTS} is equivalent to the \gls{ITASK} \gls{CRTS} (\cref{lst_t4t:itaskTempFull}), except that the sensor node is a Wemos microprocessor.
 
 \Cref{lst_t4t:mtaskTemp} shows the complete program, and the key function is \cleaninline{devTask} with a top-level \cleaninline{Main} type (\cref{lst_t4t:mtaskTemp:devTask}). In \gls{MTASK} functions, shares, and devices can only be defined at this top level.
 The program uses the same shares \cleaninline{tempSDS} and~\cleaninline{latestTemp} as \gls{CRTS}, and for completeness we repeat those definitions.
@@ -527,14 +519,14 @@ This new \gls{SDS} of type \cleaninline{Real} is lifted to the \gls{MTASK} progr
 %The \cleaninline{mapRead} ensures that every write to \cleaninline{localSds} is automatically time-stamped when it is written to \cleaninline{latestTemp}.
 
 
-The \cleaninline{mainTask} is a simple \gls{ITASK} task that starts the \cleaninline{devTask} \gls{MTASK} task on the device identified by \cleaninline{deviceInfo} (\cref{lst_t4t:mtaskTemp:withdevice}). At runtime the \gls{MTASK} slice is compiled to byte code, shipped to the indicated device, and launched. Thereafter, \cleaninline{mainTask} reads temperature values from the \cleaninline{latestTemp} \gls{SDS} that is shared with the \gls{MTASK} device, and displays them on a web page (\cref{fig_t4t:cwtsweb}). The \gls{SDS}---shared with the device using \cleaninline{liftsds}---automatically communicates new temperature values from the microcontroller to the server.
+The \cleaninline{mainTask} is a simple \gls{ITASK} task that starts the \cleaninline{devTask} \gls{MTASK} task on the device identified by \cleaninline{deviceInfo} (\cref{lst_t4t:mtaskTemp:withdevice}). At runtime the \gls{MTASK} slice is compiled to byte code, shipped to the indicated device, and launched. Thereafter, \cleaninline{mainTask} reads temperature values from the \cleaninline{latestTemp} \gls{SDS} that is shared with the \gls{MTASK} device, and displays them on a web page (\cref{fig_t4t:cwtsweb}). The \gls{SDS}---shared with the device using \cleaninline{liftsds}---automatically communicates new temperature values from the microprocessor to the server.
 
 While this simple application makes limited use of the \gls{MTASK} \gls{EDSL}, it illustrates some powerful \gls{MTASK} program abstractions like basic tasks, task combinators, named recursive and parameterized tasks, and \glspl{SDS}.
 Function composition (\cref{lst_t4t:mtaskTemp:o}) and currying (\cref{lst_t4t:mtaskTemp:setSds}) are inherited from the \gls{CLEAN} host language.
 As \gls{MTASK} tasks are dynamically compiled, it is also possible to select and customise tasks as required at runtime.
 For example, the interval used in the \cleaninline{rpeatevery} task (\cref{lst_t4t:mtaskTemp:rpeatevery}) could be a parameter to the \cleaninline{devTask} function.
 
-\newcommand{\srcmark}[1]{\marginpar[\small\emph{#1}]{\small\emph{#1}}}
+\newcommand{\srcmark}[1]{\marginpar[\footnotesize\emph{#1}]{\footnotesize\emph{#1}}}
 \begin{lstClean}[%
        numbers=left,
        caption={
@@ -571,7 +563,7 @@ mainTask :: Task Real
 mainTask
        =   withDevice deviceInfo \dev -> liftmTask} devTask dev[+\label{lst_t4t:mtaskTemp:liftmtask}+][+\label{lst_t4t:mtaskTemp:withdevice}+][+\label{lst_t4t:mtaskTemp:co2}\srcmark{CO}+]
        -|| viewSharedInformation [] latestTemp[+\label{lst_t4t:mtaskTemp:wi1}\srcmark{WI}+]
-       <<@ Title "Latest temperature"[+\label{lst_t4t:mtaskTemp:wi2}+] // WI
+       <<@ Title "Latest temperature"[+\label{lst_t4t:mtaskTemp:wi2}\srcmark{WI}+]
 \end{lstClean}
 %
 
@@ -588,18 +580,18 @@ mainTask
                \caption{Deployment diagram.}
        \end{subfigure}
        \caption{Tierless \gls{ITASK}\slash\gls{MTASK} \gls{CWTS} temperature sensing \gls{IOT} system.}%
-    \label{fig_t4t:cwtsDiagram}
+       \label{fig_t4t:cwtsDiagram}
 \end{figure}
 
 \section{\texorpdfstring{\gls{UOG}}{UoG} smart campus case study}%
 \label{sec_t4t:Case}
 The basis for our comparison between tiered and tierless technologies are four \gls{IOT} systems that all conform to the \gls{UOG} smart campus specifications (\cref{sec_t4t:OperationalComparison}). There is a small (12 room) deployment of the conventional \gls{PYTHON}-based \gls{PRS} stack that uses Raspberry Pi supersensors, and its direct comparator is the tierless \gls{CRS} implementation: also deployed on Raspberry Pis.
-To represent the more common microcontroller sensor nodes we select ESP8266X powered Wemos D1 Mini microcontrollers. To evaluate tierless technologies on microcontrollers we compare the conventional \gls{PYTHON}\slash\gls{MICROPYTHON} \gls{PWS} stack with the tierless \gls{CWS} implementation. 
+To represent the more common microprocessor sensor nodes we select ESP8266X powered Wemos D1 Mini microcontrollers. To evaluate tierless technologies on microcontrollers we compare the conventional \gls{PYTHON}\slash\gls{MICROPYTHON} \gls{PWS} stack with the tierless \gls{CWS} implementation. 
 
 %The four systems under comparison are different in architecture ---tiered or tierless--- and type of sensor node hardware ---regular or embedded--- but they share many properties as well.
 
-%The embedded sensor nodes are all implemented on the ESP8266X powered Wemos D1 Mini microcontroller.
-A similar range of commodity sensors is connected to both the Raspberry Pi and Wemos sensor nodes using various low-level communication protocols such as \gls{GPIO}, \gls{I2C}, \gls{SPI} and \gls{ONEWIRE}. The sensors are as follows: Temperature \& Humidity: LOLIN SHT30; Light: LOLIN BH1750; Motion: LOLIN \gls{PIR}; Sound: SparkFun SEN-12642; \gls{ECO2}:  SparkFun CCS811.
+%The embedded sensor nodes are all implemented on the ESP8266X powered Wemos D1 Mini microprocessor.
+A similar range of commodity sensors is connected to both the Raspberry Pi and Wemos sensor nodes using various low-level communication protocols such as \gls{GPIO}, \gls{I2C}, \gls{SPI} and \gls{ONEWIRE}. The sensors are as follows: Temperature \& Humidity: LOLIN SHT30; Light: LOLIN BH1750; Motion: LOLIN \gls{PIR}; Sound: SparkFun SEN-12642; \gls{ECO2}: SparkFun CCS811.
 
 \Cref{fig_t4t:wemos_prss} shows both a prototype Wemos-based sensor node and sensors and a Raspberry Pi supersensor. Three different development teams developed the four implementations: \gls{CWS} and \gls{CRS} were engineered by a single developer.
 
@@ -628,13 +620,13 @@ Communication between a sensor node and the server is always initiated by the no
 relatively powerful Raspberry Pi 3 Model Bs. There is a simple object-oriented \gls{PYTHON} collector for configuring the sensors and reading their values. The collector daemon service marshals the sensor data and transmits using \gls{MQTT} to the central monitoring server at a preset frequency.
 The collector caches sensor data locally when the server is unreachable.
 
-In contrast to \gls{PRS}, \gls{PWS}'s sensor nodes are microcontrollers running \gls{MICROPYTHON}, a dialect of \gls{PYTHON} specifically designed to run on small, low powered embedded devices~\citep{kodali2016low}.
-To enable a fair comparison between the software stacks we are careful to use the same object-oriented software architecture, e.g.\ using the same classes in  \gls{PWS} and \gls{PRS}.
+In contrast to \gls{PRS}, \gls{PWS}'s sensor nodes are microprocessors running \gls{MICROPYTHON}, a dialect of \gls{PYTHON} specifically designed to run on small, low powered embedded devices~\citep{kodali2016low}.
+To enable a fair comparison between the software stacks we are careful to use the same object-oriented software architecture, e.g.\ using the same classes in \gls{PWS} and \gls{PRS}.
 
 \Gls{PYTHON} and \gls{MICROPYTHON} are appropriate tiered comparison languages. Tiered \gls{IOT} systems are implemented in a whole range of programming languages, with \gls{PYTHON}, \gls{MICROPYTHON}, \gls{C} and \gls{CPP} being popular for some tiers in many implementations. \gls{C}\slash\gls{CPP} implementations would probably result in more verbose programs and even less type safety.
 The other reasons for selecting \gls{PYTHON} and \gls{MICROPYTHON} are pragmatic. \gls{PRS} had been constructed in \gls{PYTHON}, deployed, and was being used as an \gls{IOT} experimental platform. 
-Selecting \gls{MICROPYTHON} for the resource-constrained  \gls{PWS} sensor nodes facilitates comparison by minimising changes to the resource-rich and resource-constrained codebases.
-We anticipate that the codebase for a tiered smart campus implementation in another imperative/object-oriented language, like \gls{CPP},  would be broadly similar to the \gls{PRS} and \gls{PWS} codebases.
+Selecting \gls{MICROPYTHON} for the resource-constrained \gls{PWS} sensor nodes facilitates comparison by minimising changes to the resource-rich and resource-constrained codebases.
+We anticipate that the codebase for a tiered smart campus implementation in another imperative/object-oriented language, like \gls{CPP}, would be broadly similar to the \gls{PRS} and \gls{PWS} codebases.
 
 \subsection{Tierless implementations}
 
@@ -646,7 +638,7 @@ Communication between a sensor node and the server is initiated by the server.
 \Gls{CRS}'s sensor nodes are Raspberry Pi 4s, and execute \gls{CLEAN}\slash\gls{ITASK} programs.
 Communication from the sensor node to the server is implicit and happens via \glspl{SDS} over \gls{TCP} using platform independent execution graph serialisation~\citep{oortgiese_distributed_2017}.
 
-\Gls{CWS}'s sensor nodes are Wemos microcontrollers running \gls{MTASK} tasks. Communication and serialisation is, by design,  very similar to \gls{ITASK}, i.e.\ via \glspl{SDS} over either a serial port connection, raw \gls{TCP}, or \gls{MQTT} over \gls{TCP}.
+\Gls{CWS}'s sensor nodes are Wemos microprocessors running \gls{MTASK} tasks. Communication and serialisation is, by design, very similar to \gls{ITASK}, i.e.\ via \glspl{SDS} over either a serial port connection, raw \gls{TCP}, or \gls{MQTT} over \gls{TCP}.
 
 \begin{figure}[ht]
        \centering
@@ -664,13 +656,13 @@ Communication from the sensor node to the server is implicit and happens via \gl
        \label{fig_t4t:webinterfaces}
 \end{figure}
 
-\subsection{Operational Equivalence}%
+\subsection{Operational equivalence}%
 \label{sec_t4t:OperationalComparison}
 
 
 To ensure that the comparison reported in the following sections is based on \gls{IOT} stacks with equivalent functionality, we demonstrate that \gls{PWS}, \gls{CWS} and \gls{CRS}, like \gls{PRS}, meet the functional requirements for the \gls{UOG} smart campus sensor system. We also compare the sensor node power consumption and memory footprint.
 
-\subsubsection{Functional Requirements}%
+\subsubsection{Functional requirements}%
 \label{sec_t4t:Validation}
 
 The main goal of the \gls{UOG} smart campus project is to provide a testbed for sensor nodes and potentially other devices to act as a data collection and computation platform for the \gls{UOG} smart campus. The high-level functional requirements, as specified by the \gls{UOG} smart campus project board, are as follows. The system should:
@@ -695,7 +687,7 @@ The main goal of the \gls{UOG} smart campus project is to provide a testbed for
 \end{enumerate}
 All four smart campus implementations meet these high-level requirements.
 
-\subsubsection{Functional Equivalence}
+\subsubsection{Functional equivalence}
 
 Observation of the four implementations shows that they operate as expected, e.g.\ detecting light or motion. To illustrate \cref{fig_t4t:webinterfaces} shows the web interface for the implementations where \gls{CWS} and \gls{CRS} are deployed in a different room from \gls{PWS} and \gls{PRS}.
 
@@ -704,11 +696,11 @@ All four implementations use an identical set of inexpensive sensors, so we expe
 % Phil: lets see what the reviewers say
 
 
-\subsubsection{Memory and Power Consumption}%
+\subsubsection{Memory and power consumption}%
 %\subsubsection{Memory Consumption}%
 \label{sec_t4t:MemPower}
 
-\paragraph{Memory} By design sensor nodes are devices with limited computational capacity, and memory is a key restriction. Even supersensors often have less than a \unit{\gibi\byte} of memory, and microcontrollers often have just tens of \unit{\kibi\byte{}s}.
+\paragraph{Memory} By design sensor nodes are devices with limited computational capacity, and memory is a key restriction. Even supersensors often have less than a \unit{\gibi\byte} of memory, and microprocessors often have just tens of \unit{\kibi\byte{}s}.
 %In a tiered implementation the memory residency of the sensor node code can be minimised by carefully crafting it in a language that minimises memory residency. However, ...
 As the tierless languages synthesize the code to be executed on the sensor nodes, we need to confirm that the generated code is sufficiently memory efficient.
 
@@ -720,15 +712,15 @@ As the tierless languages synthesize the code to be executed on the sensor nodes
                \toprule
                \multicolumn{1}{c}{\gls{PWS}} & \multicolumn{1}{c}{\gls{PRS}} & \multicolumn{1}{c}{\gls{CWS}} & \multicolumn{1}{c}{\gls{CRS}}\\
                \midrule
-               \num{20270}       & \num{3557806}      & \num{880}       & \num{2726680}\\
+               \num{20270} & \num{3557806} & \num{880} & \num{2726680}\\
                \bottomrule
        \end{tabular}
 \end{table}
 
-\Cref{tbl_t4t:mem} shows the maximum memory residency after garbage collection of the sensor node for all four smart campus implementations. The smart campus sensor node programs executing on the Wemos microcontrollers have low maximum residencies: \qty{20270}{\byte} for \gls{PWS} and \qty{880}{\byte} for \gls{CWS}. In \gls{CWS} the \gls{MTASK} system generates very high level \gls{TOP} byte code that is interpreted by the \gls{MTASK} virtual machine and uses a small and predictable amount of heap memory.
+\Cref{tbl_t4t:mem} shows the maximum memory residency after garbage collection of the sensor node for all four smart campus implementations. The smart campus sensor node programs executing on the Wemos microprocessors have low maximum residencies: \qty{20270}{\byte} for \gls{PWS} and \qty{880}{\byte} for \gls{CWS}. In \gls{CWS} the \gls{MTASK} system generates very high level \gls{TOP} byte code that is interpreted by the \gls{MTASK} virtual machine and uses a small and predictable amount of heap memory.
 In \gls{PWS}, the hand-written \gls{MICROPYTHON} is compiled to byte code for execution on the virtual machine. Low residency is achieved with a fixed size heap and efficient memory management. For example both \gls{MICROPYTHON} and \gls{MTASK} use fixed size allocation units and mark\&sweep garbage collection to minimise memory usage at the cost of some execution time~\citep{plamauer2017evaluation}.
 
-The smart campus sensor node programs executing on the Raspberry Pis have far higher maximum residencies than those executing on the microcontrollers: \qty{3.5}{\mebi\byte} for \gls{PRS} and \qty{2.7}{\mebi\byte} for \gls{CRS}. In \gls{CRS} the sensor node code is a set of \gls{ITASK} executing on a full-fledged \gls{ITASK} server running in distributed child mode and this consumes far more memory.
+The smart campus sensor node programs executing on the Raspberry Pis have far higher maximum residencies than those executing on the microprocessors: \qty{3.5}{\mebi\byte} for \gls{PRS} and \qty{2.7}{\mebi\byte} for \gls{CRS}. In \gls{CRS} the sensor node code is a set of \gls{ITASK} executing on a full-fledged \gls{ITASK} server running in distributed child mode and this consumes far more memory.
 %The memory used is actually very similar to the memory usage of the server with a single client connected.
 In \gls{PRS} the sensor node program is written in \gls{PYTHON}, a language far less focused on minimising memory usage than \gls{MICROPYTHON}. For example an object like a string is larger in \gls{PYTHON} than in \gls{MICROPYTHON} and consequently does not support all features such as \emph{f-strings}.
 Furthermore, not all advanced \gls{PYTHON} feature regarding classes are available in \gls{MICROPYTHON}, i.e.\ only a subset of the \gls{PYTHON} specification is supported~\citep{diffmicro}.%\mlcomment{reference \url{https://docs.micropython.org/en/latest/genrst/index.html} ? It contains an overview of supported features}
@@ -740,28 +732,28 @@ In summary the sensor node code generated by both tierless languages, \gls{ITASK
 %\mlcomment{There only seems to be anecdotal evidence of this. See: \url{https://www.element14.com/community/people/neilk/blog/2019/02/14/investigating-the-power-consumption-of-a-wemos-d1-mini-esp8266}}
 %\pkcomment{We can state that our own measurements are consistent the experience of others.}
 The Wemos sensor nodes used in \gls{CWS} and \gls{PWS} have the low power consumption of a typical embedded device: with all sensors enabled, they consume around \qty{0.2}{\watt}.
-The Raspberry Pi supersensor node used in \gls{CRS} and \gls{PRS} use more power as they have a general purpose ARM processor and run mainstream Linux. With all sensors enabled, they consume \qtyrange{1}{2}{\watt}, depending on ambient load. So a microcontroller sensor node consumes an order of magnitude less power than a supersensor node.
+The Raspberry Pi supersensor node used in \gls{CRS} and \gls{PRS} use more power as they have a general purpose ARM processor and run mainstream Linux. With all sensors enabled, they consume \qtyrange{1}{2}{\watt}, depending on ambient load. So a microprocessor sensor node consumes an order of magnitude less power than a supersensor node.
 
 
-\section{Is Tierless \texorpdfstring{\gls{IOT}}{IoT} Programming Easier than Tiered?}%
+\section[Is tierless \texorpdfstring{\gls{IOT}}{IoT} programming easier than tiered?]{\hspace{-9pt}Is tierless \texorpdfstring{\gls{IOT}}{IoT} programming easier than tiered?}%
 \label{sec_t4t:ProgrammingComparison}
 
 
-This section investigates whether tierless languages make \gls{IOT} programming \emph{easier} by comparing the  \gls{UOG} smart campus implementations. The \gls{CRS} and \gls{CWS} implementations allow us to evaluate tierless languages for
+This section investigates whether tierless languages make \gls{IOT} programming \emph{easier} by comparing the \gls{UOG} smart campus implementations. The \gls{CRS} and \gls{CWS} implementations allow us to evaluate tierless languages for
  resource-rich and for resource-constrained sensor nodes respectively. The \gls{PRS} and \gls{PWS} allow a like-for-like comparison with tiered \gls{PYTHON} implementations.
 
 
 %\subsection{Temperature Sensor Illustration}
 
-\subsection{Comparing Tiered and Tierless Codebases}%
+\subsection{Comparing tiered and tierless codebases}%
 \label{sec_t4t:codesize}
 %A comparison of the Temperature sensor in \gls{PYTHON} Micropyton, Itask \& \gls{MTASK}.
 
-\paragraph{Code Size} is widely recognised as an approximate measure of the development and maintenance effort required for a software system~\citep{rosenberg1997some}. \gls{SLOC} is a common code size metric, and is especially useful for multi-paradigm systems like \gls{IOT} systems. It is based on the simple principle that the more \gls{SLOC}, the more developer effort and the increased likelihood of  bugs~\citep{rosenberg1997some}. It is a simple measure, not dependent on some formula, and can be automatically computed~\citep{sheetz2009understanding}.
+\paragraph{Code size} is widely recognised as an approximate measure of the development and maintenance effort required for a software system~\citep{rosenberg1997some}. \gls{SLOC} is a common code size metric, and is especially useful for multi-paradigm systems like \gls{IOT} systems. It is based on the simple principle that the more \gls{SLOC}, the more developer effort and the increased likelihood of bugs~\citep{rosenberg1997some}. It is a simple measure, not dependent on some formula, and can be automatically computed~\citep{sheetz2009understanding}.
 
 Of course \gls{SLOC} must be used carefully as it is easily influenced by programming style, language paradigm, and counting method~\citep{alpernaswonderful}. Here we are counting code to compare development effort, use the same idiomatic programming style in each component, and only count lines of code, omitting comments and blank lines.
 
-\Cref{table_t4t:multi} enumerates the \gls{SLOC} required to implement the \gls{UOG} smart campus functionalities in  \gls{PWS}, \gls{PRS}, \gls{CWS} and \gls{CRS}. Both \gls{PYTHON} and \gls{CLEAN} implementations use the same server and communication code for Raspberry Pi and for Wemos sensor nodes (rows 5--7 of the table).
+\Cref{table_t4t:multi} enumerates the \gls{SLOC} required to implement the \gls{UOG} smart campus functionalities in \gls{PWS}, \gls{PRS}, \gls{CWS} and \gls{CRS}. Both \gls{PYTHON} and \gls{CLEAN} implementations use the same server and communication code for Raspberry Pi and for Wemos sensor nodes (rows 5--7 of the table).
 The Sensor Interface (SI) refers to code facilitating the communication between the peripherals and the sensor node software. % formerly hardware interface
 Sensor Node (SN) code contains all other code on the sensor node that does not belong to any another category, such as control flow. % formerly device output
 %Server communication denotes code that provides the high level communication between the sensor node and the server.
@@ -774,7 +766,7 @@ The most striking information in \cref{table_t4t:multi} is that \emph{the tierle
 
 \begin{table}
        \centering % used for centering table
-       \caption{Comparing tiered and tierless smart campus code sizes: \gls{SLOC} and number of source files. \gls{PWS} and \gls{CWS} execute on resource-constrained sensor nodes, while  \gls{PRS} and \gls{CRS} execute on resource-rich sensor nodes.}%
+       \caption{Comparing tiered and tierless smart campus code sizes: \gls{SLOC} and number of source files. \gls{PWS} and \gls{CWS} execute on resource-constrained sensor nodes, while \gls{PRS} and \gls{CRS} execute on resource-rich sensor nodes.}%
        \label{table_t4t:multi}
        \begin{tabular}{l l c c c c } % centered columns (4 columns)
                \toprule
@@ -796,7 +788,7 @@ The most striking information in \cref{table_t4t:multi} is that \emph{the tierle
        \end{tabular}
 \end{table}
 
-\paragraph{Code Proportions.} Comparing the percentages of code required to implement the smart campus functionalities normalises the data and avoids some issues when comparing \gls{SLOC} for different programming languages, and especially for languages with different paradigms like object-oriented \gls{PYTHON} and functional \gls{CLEAN}. \Cref{fig_t4t:multipercentage} shows the percentage of the total \gls{SLOC} required to implement the smart campus functionalities in each of the four implementations, and is computed from the data in \cref{table_t4t:multi}. It shows that there are significant differences between the percentage of code for each functionality between the tiered and tierless implementations. For example 17\% of the tiered implementations specifies communication, whereas this requires only 3\% of the tierless implementations, i.e.\ 6$\times$ less. We explore the reasons for this in \cref{sec_t4t:Communication}. The other major difference is the massive percentage of   Database Interface code in the tierless implementations: at least 47\%. The smart campus specification required a standard DBMS, and the \gls{CLEAN}\slash\gls{ITASK} SQL interface occupies some 78 \gls{SLOC}. While this is a little less than the 106 \gls{SLOC} used in \gls{PYTHON} (\cref{table_t4t:multi}), it is a far higher percentage of systems with total codebases of only around 160 \gls{SLOC}. Idiomatic \gls{CLEAN}/\gls{ITASK} would use high level abstractions to store persistent data in an \gls{SDS}, requiring just a few \gls{SLOC}.
+\paragraph{Code proportions.} Comparing the percentages of code required to implement the smart campus functionalities normalises the data and avoids some issues when comparing \gls{SLOC} for different programming languages, and especially for languages with different paradigms like object-oriented \gls{PYTHON} and functional \gls{CLEAN}. \Cref{fig_t4t:multipercentage} shows the percentage of the total \gls{SLOC} required to implement the smart campus functionalities in each of the four implementations, and is computed from the data in \cref{table_t4t:multi}. It shows that there are significant differences between the percentage of code for each functionality between the tiered and tierless implementations. For example 17\% of the tiered implementations specifies communication, whereas this requires only 3\% of the tierless implementations, i.e.\ 6$\times$ less. We explore the reasons for this in \cref{sec_t4t:Communication}. The other major difference is the massive percentage of Database Interface code in the tierless implementations: at least 47\%. The smart campus specification required a standard DBMS, and the \gls{CLEAN}\slash\gls{ITASK} SQL interface occupies some 78 \gls{SLOC}. While this is a little less than the 106 \gls{SLOC} used in \gls{PYTHON} (\cref{table_t4t:multi}), it is a far higher percentage of systems with total codebases of only around 160 \gls{SLOC}. Idiomatic \gls{CLEAN}/\gls{ITASK} would use high level abstractions to store persistent data in an \gls{SDS}, requiring just a few \gls{SLOC}.
 The total size of \gls{CWS} and \gls{CRS} would be reduced by a factor of two and the percentage of Database Interface code would be even less than in the tiered \gls{PYTHON} implementations.
 
 
@@ -807,22 +799,22 @@ The total size of \gls{CWS} and \gls{CRS} would be reduced by a factor of two an
        \label{fig_t4t:multipercentage}
 \end{figure}
 
-\subsection{Comparing  Codebases for Resource-Rich/Constrained Sensor Nodes}%
+\subsection{Comparing codebases for resource-rich\slash{}constrained sensor nodes}%
 \label{sec_t4t:resourcerich}
 
-Before exploring the reasons for the smaller tierless codebase we compare the implementations for resource-rich and resource-constrained sensor nodes, again using \gls{SLOC} and code proportions. \Cref{table_t4t:multi} shows that the two tiered implementations are very similar in size: with \gls{PWS} for microcontrollers requiring 562 \gls{SLOC} and \gls{PRS} for supersensors requiring 576 \gls{SLOC}.
-The two tierless implementations are also similar in size: \gls{CWS} requiring 166 and  \gls{CRS} 155 \gls{SLOC}.
+Before exploring the reasons for the smaller tierless codebase we compare the implementations for resource-rich and resource-constrained sensor nodes, again using \gls{SLOC} and code proportions. \Cref{table_t4t:multi} shows that the two tiered implementations are very similar in size: with \gls{PWS} for microprocessors requiring 562 \gls{SLOC} and \gls{PRS} for supersensors requiring 576 \gls{SLOC}.
+The two tierless implementations are also similar in size: \gls{CWS} requiring 166 and \gls{CRS} 155 \gls{SLOC}.
 
-There are several main reasons for the similarity. One is that the server-side code, i.e.\ for the presentation and application layers, is identical for both resource rich/constrained implementations. The identical server code accounts for approximately 40\% of the  \gls{PWS} and  \gls{PRS} codebases, and approximately 85\% of the  \gls{CWS} and  \gls{CRS} codebases (\cref{fig_t4t:multipercentage}). For the perception and network layers on the sensor nodes, the \gls{PYTHON} and \gls{MICROPYTHON} implementations have the same structure, e.g.\ a class for each type of sensor, and use analogous libraries. Indeed, approaches like CircuitPython~\citep{CircuitPython} allow the same code to execute on both resource-rich and resource-constrained sensor nodes.
+There are several main reasons for the similarity. One is that the server-side code, i.e.\ for the presentation and application layers, is identical for both resource rich/constrained implementations. The identical server code accounts for approximately 40\% of the \gls{PWS} and \gls{PRS} codebases, and approximately 85\% of the \gls{CWS} and \gls{CRS} codebases (\cref{fig_t4t:multipercentage}). For the perception and network layers on the sensor nodes, the \gls{PYTHON} and \gls{MICROPYTHON} implementations have the same structure, e.g.\ a class for each type of sensor, and use analogous libraries. Indeed, approaches like CircuitPython~\citep{CircuitPython} allow the same code to execute on both resource-rich and resource-constrained sensor nodes.
 
 
 Like \gls{PYTHON} and \gls{MICROPYTHON}, \gls{ITASK} and \gls{MTASK} are designed to be similar, as elaborated in \cref{sec_t4t:ComparingTierless}. The similarity is apparent when comparing the \gls{ITASK} \gls{CRTS} and \gls{ITASK}\slash\gls{MTASK} \gls{CWTS} room temperature systems in \cref{lst_t4t:itaskTempFull,lst_t4t:mtaskTemp}. That is, both implementations use similar \glspl{SDS} and lenses; they have similar \cleaninline{devTask}s that execute on the sensor node, and the server-side \cleaninline{mainTask}s are almost identical: they deploy the remote \cleaninline{devTask} before generating the web page to report the readings.
 
-In both \gls{PYTHON} and \gls{CLEAN} the resource-constrained implementations are less than 7\% larger than the resource-rich implementations. This suggests that \emph{the development and maintenance effort of simple \gls{IOT} systems for resource-constrained and for resource-rich sensor nodes is similar in  tierless technologies,} just as it is in tiered technologies.
-A caveat is that the smart campus system is relatively simple, and  developing more complex perception and network code on bare metal may prove more challenging. That is, the lack of \gls{OS} support, and the restricted languages and libraries, may have greater impact. We return to this issue in \cref{sec_t4t:ComparingTierless}.
+In both \gls{PYTHON} and \gls{CLEAN} the resource-constrained implementations are less than 7\% larger than the resource-rich implementations. This suggests that \emph{the development and maintenance effort of simple \gls{IOT} systems for resource-constrained and for resource-rich sensor nodes is similar in tierless technologies,} just as it is in tiered technologies.
+A caveat is that the smart campus system is relatively simple, and developing more complex perception and network code on bare metal may prove more challenging. That is, the lack of \gls{OS} support, and the restricted languages and libraries, may have greater impact. We return to this issue in \cref{sec_t4t:ComparingTierless}.
 
 
-\subsection{Reduced Interoperation}%
+\subsection{Reduced interoperation}%
 \label{sec_t4t:interoperation}
 \begin{table}
        \centering
@@ -880,7 +872,7 @@ The tierless implementations use just two conceptually-similar \glspl{DSL} embed
 
 Interoperation \emph{increases the cognitive load on the developer} who must simultaneously think in multiple languages and paradigms. This is commonly known as semantic friction or impedance mismatch~\citep{ireland2009classification}. A simple illustration of this is that the tiered \gls{PRS} source code comprises some 38 source and configuration files, whereas the tierless \gls{CRS} requires just 3 files (\cref{table_t4t:multi}). The source could be structured as a single file, but to separate concerns is structured into three modules, one each for \glspl{SDS}, types, and control logic~\citep{wang_maintaining_2018}.
 
-The developer must \emph{correctly interoperate the components}, e.g.\ adhere to the \gls{API} or communication protocols between components. The interoperation often entails additional programming tasks like marshalling or demarshalling data between components. For example, in the tiered \gls{PRS} and \gls{PWS} architectures, \gls{JSON} is used to serialise and deserialise data strings  from the \gls{PYTHON} collector component before storing the data in the Redis database (\cref{lst_t4t:json}).
+The developer must \emph{correctly interoperate the components}, e.g.\ adhere to the \gls{API} or communication protocols between components. The interoperation often entails additional programming tasks like marshalling or demarshalling data between components. For example, in the tiered \gls{PRS} and \gls{PWS} architectures, \gls{JSON} is used to serialise and deserialise data strings from the \gls{PYTHON} collector component before storing the data in the Redis database (\cref{lst_t4t:json}).
 %e.g.\ to marshall and demarshall data between components.
 
 %\mlcomment{A listing must have a caption for it to be labeled and referenced}
@@ -902,7 +894,7 @@ try:
 
 To ensure correctness the developer \emph{must maintain type safety} across a range of very different languages and diverse type systems, and we explore this further in \cref{sec_t4t:typesafety}. The developer must also deal with the \emph{potentially diverse failure modes}, not only of each component, but also of their interoperation, e.g.\ if a value of an unexpected type is passed through an \gls{API}. We explore this further in \cref{sec_t4t:NetworkManagement}.
 
-\subsection{Automatic Communication}%
+\subsection{Automatic communication}%
 \label{sec_t4t:Communication}
 
 In conventional tiered \gls{IOT} implementations the developer must write and maintain code to communicate between tiers. For example \gls{PRS} and \gls{PWS} create, send and read \gls{MQTT}~\citep{light2017mosquitto} messages
@@ -924,7 +916,7 @@ def main():
                        [+\ldots+]
 \end{lstPython}
 
-In contrast, the tierless \gls{CWS} and \gls{CRS} communication is not only highly automated, but also automatically correct because matching sender and receiver code is generated by the compiler. \Cref{table_t4t:multi} shows that communication is specified in  just 5 \gls{SLOC} in \gls{CWS} and 4 in \gls{CRS}, or just 3\% of the codebase (bottom bars in \cref{fig_t4t:multipercentage}).
+In contrast, the tierless \gls{CWS} and \gls{CRS} communication is not only highly automated, but also automatically correct because matching sender and receiver code is generated by the compiler. \Cref{table_t4t:multi} shows that communication is specified in just 5 \gls{SLOC} in \gls{CWS} and 4 in \gls{CRS}, or just 3\% of the codebase (bottom bars in \cref{fig_t4t:multipercentage}).
 
 
 \Cref{lst_t4t:mtaskTemp} illustrates communication in a tierless \gls{IOT} language. That is, the \gls{CWTS} temperature sensor requires just three lines of communication code, and uses just three communication functions. The
@@ -933,15 +925,15 @@ In contrast, the tierless \gls{CWS} and \gls{CRS} communication is not only high
 The \cleaninline{liftsds} on \cref{lst_t4t:mtaskTemp:liftsds} integrates \glspl{SDS} from \gls{ITASK} into \gls{MTASK}, allowing \gls{MTASK} tasks to interact with data from the \gls{ITASK} server.
 The exchange of data, user interface, and communication are all automatically generated.
 
-\subsection{High Level Abstractions}%
+\subsection{High level abstractions}%
 \label{sec_t4t:abstractions}
 
 Another reason that the tierless \gls{CLEAN} implementations are concise is because they use powerful higher order \gls{IOT} programming abstractions.
 For comprehensibility the simple temperature sensor from \cref{sec_t4t:mtasks} (\cref{lst_t4t:mtaskTemp}) is used to compare the expressive power of \gls{CLEAN} and \gls{PYTHON}-based \gls{IOT} programming abstractions.
 There are implementations for all four configurations: \gls{PRTS} (\gls{PYTHON} Raspberry Pi Temperature Sensor)\footnotemark, \gls{PWTS}\footnotemark[\value{footnote}]\todo{the dataset will be uploaded, the DOI is reserved.}
-\footnotetext{Lubbers, M.; Koopman, P.; Ramsingh, A.; Singer, J.; Trinder, P. (2021): Source code, line counts and memory stats for PRS, PWS, PRT and PWT.\ Zenodo.\  \href{https://doi.org/10.5281/zenodo.5081386}{10.5281/zenodo.5081386}.}, \gls{CRTS}\footnotemark{} and \gls{CWTS}\footnotemark[\value{footnote}] \todo{the dataset will be uploaded, the DOI is reserved.}
-\footnotetext{Lubbers, M.; Koopman, P.; Ramsingh, A.; Singer, J.; Trinder, P. (2021): Source code, line counts and memory stats for CRS, CWS, CRTS and CWTS.\ Zenodo.\  \href{https://doi.org/10.5281/zenodo.5040754}{10.5281/zenodo.5040754}.}
-but as the programming abstractions are broadly similar,  we compare only the \gls{PWTS} and \gls{CWTS} implementations.
+\footnotetext{Lubbers, M.; Koopman, P.; Ramsingh, A.; Singer, J.; Trinder, P. (2021): Source code, line counts and memory stats for PRS, PWS, PRT and PWT.\ Zenodo.\ \href{https://doi.org/10.5281/zenodo.5081386}{10.5281/zenodo.5081386}.}, \gls{CRTS}\footnotemark{} and \gls{CWTS}\footnotemark[\value{footnote}] \todo{the dataset will be uploaded, the DOI is reserved.}
+\footnotetext{Lubbers, M.; Koopman, P.; Ramsingh, A.; Singer, J.; Trinder, P. (2021): Source code, line counts and memory stats for CRS, CWS, CRTS and CWTS.\ Zenodo.\ \href{https://doi.org/10.5281/zenodo.5040754}{10.5281/zenodo.5040754}.}
+but as the programming abstractions are broadly similar, we compare only the \gls{PWTS} and \gls{CWTS} implementations.
 
 Although the temperature sensor applications are small compared to the smart campus application, they share some typical \gls{IOT} stack traits.
 The architecture consists of a server and a single sensor node (\cref{fig_t4t:cwtsDiagram}).
@@ -974,18 +966,18 @@ The multiple tiers in \gls{PRS} and \gls{PWS} provide different levels of abstra
 %in order to facilitate interoperation of the components.
 However, there are various ways that high-level abstractions make the \gls{CWS} much shorter than \gls{PRS} and \gls{PWS} implementations.
 
-Firstly, functional programming languages are  generally more concise than most other programming languages because their powerful abstractions like higher-order and/or polymorphic functions require less code to describe a computation.
+Firstly, functional programming languages are generally more concise than most other programming languages because their powerful abstractions like higher-order and/or polymorphic functions require less code to describe a computation.
 Secondly, the \gls{TOP} paradigm used in \gls{ITASK} and \gls{MTASK} reduces the code size further by making it easy to specify \gls{IOT} functionality concisely.
 As examples, the step combinator \cleaninline{>>*.} allows the task value on the left-hand side to be observed until one of the steps is enabled;
 and the \cleaninline{viewSharedInformation} (line 31 of \cref{lst_t4t:mtaskTemp}) part of the UI will be automatically updated when the value of the \gls{SDS} changes. Moreover, each \gls{SDS} provides automatic updates to all coupled \glspl{SDS} and associated tasks. Thirdly, the amount of explicit type information is minimised in comparison to other languages, as much is automatically inferred~\citep{hughes1989functional}.
 
-\section{Could Tierless \texorpdfstring{\gls{IOT}}{IoT} Programming Be More Reliable than Tiered?}%
+\section{Could tierless \texorpdfstring{\gls{IOT}}{IoT} programming be more reliable than tiered?}%
 \label{sec_t4t:Discussion}
 
 
 This section investigates whether tierless languages make \gls{IOT} programming more reliable. Arguably the much smaller and simpler code base is inherently more understandable, and more likely to be correct. Here we explore specific language issues, namely those of preserving type safety, maintainability, failure management, and community support.
 
-\subsection{Type Safety}%
+\subsection{Type safety}%
 \label{sec_t4t:typesafety}
 Strong typing identifies errors early in the development cycle, and hence plays a crucial role in improving software quality. In consequence almost all modern languages provide strong typing, and encourage static typing to minimise runtime errors.
 % Phil: so widely known that a citation is unnecessary~\citep{madsen1990strong}.
@@ -993,7 +985,7 @@ That said, many distributed system components written in languages that primaril
 
 In a typical tiered multi-language \gls{IOT} system the developer must integrate software in different languages with very different type systems, and potentially executing on different hardware. The challenges of maintaining type safety have long been recognised as a major component of the semantic friction in multi-language systems, e.g.\ \citep{ireland2009classification}.
 
-Even if the different languages used in two components are both strongly typed,  they may attribute, often quite subtly, different types to a value. Such type errors can lead to runtime errors, or the application silently reporting erroneous data. Such errors can be hard to find. Automatic detection of such errors is sometimes possible, but requires an addition tool like Jinn~\citep{Jinn,Furr2005}.
+Even if the different languages used in two components are both strongly typed, they may attribute, often quite subtly, different types to a value. Such type errors can lead to runtime errors, or the application silently reporting erroneous data. Such errors can be hard to find. Automatic detection of such errors is sometimes possible, but requires an addition tool like Jinn~\citep{Jinn,Furr2005}.
 %Such errors can be hard to debug, partly because there is very limited tool support for detecting them
 %Phil: another possible source to discuss ~\citep{egyed1999automatically}
 
@@ -1012,10 +1004,10 @@ channel = 'sensor_status.%s.%s' % (hostname,
 
 Analysis of the \gls{PRS} codebase reveals an instance where it, fairly innocuously, loses type safety. The fragment in \cref{lst_t4t:float} first shows a \pythoninline{double} sensor value being sent from the sensor node, and then shows the value being stored in Redis as a \pythoninline{string} on the server. As \gls{PWS} preserves the same server components it also suffers from the same loss of type safety.
 
-\emph{A tierless language makes it possible to guarantee type safety across an entire \gls{IOT} stack}.  For example the \gls{CLEAN} compiler guarantees static type safety as the entire \gls{CWS} software stack is type checked, and  generated, from a single source. Tierless web stack languages like Links~\citep{cooper2006links} and Hop~\citep{serrano2006hop} provide the same guarantee for web stacks.
+\emph{A tierless language makes it possible to guarantee type safety across an entire \gls{IOT} stack}. For example the \gls{CLEAN} compiler guarantees static type safety as the entire \gls{CWS} software stack is type checked, and generated, from a single source. Tierless web stack languages like Links~\citep{cooper2006links} and Hop~\citep{serrano2006hop} provide the same guarantee for web stacks.
 
 
-\subsection{Failure Management}%
+\subsection{Failure management}%
 \label{sec_t4t:NetworkManagement}
 
 Some \gls{IOT} applications, including smart campus and other building monitoring applications, require high sensor uptimes. Hence, if a sensor or sensor node fails the application layer must be notified, so that it can report the failure. In the \gls{UOG} smart campus system a building manager is alerted to replace the failed device.
@@ -1031,7 +1023,7 @@ failover :: [TCPSettings] (Main (MTask BCInterpret a)) -> Task a
 failover []     _     = throw "Exhausted device pool"
 failover [d:ds] mtask = try ( withDevice d (liftmTask mtask) ) except
 where except MTEUnexpectedDisconnect = failover ds mtask
-      except _                       = throw e
+         except _                       = throw e
 \end{lstClean}
 
 In the \gls{UOG} smart campus application, this can be done by creating a pool of sensor nodes for each room and when a sensor node fails, assign another one to the task.
@@ -1075,46 +1067,49 @@ There are few maintainers of the \glspl{DSL} and documentation is often sparse.
 Acquiring information about the systems requires distilling academic papers and referring to the source code.
 There is a \gls{CLEAN} \gls{IDE}, but it does not contain support for the \gls{ITASK} or \gls{MTASK} \glspl{DSL}.
 
-\section{Comparing Tierless Languages for Resource-rich/constrained Sensor Nodes}%
+\section{Comparing tierless languages for resource-rich/constrained sensor nodes}%
 \label{sec_t4t:ComparingTierless}
 
-This section compares two tierless  \gls{IOT} languages: one for resource-rich, and the other for resource-constrained, sensor nodes. Key issues are the extent to which the very significant resource constraints of a microcontroller limit the language, and the benefits of executing on bare metal, i.e.\ without an \gls{OS}.
+This section compares two tierless \gls{IOT} languages: one for resource-rich, and the other for resource-constrained, sensor nodes. Key issues are the extent to which the very significant resource constraints of a microprocessor limit the language, and the benefits of executing on bare metal, i.e.\ without an \gls{OS}.
 
 With the tierless \gls{CLEAN} technologies described here, \gls{ITASK} are always used to program the application and presentation layers of the \gls{IOT} stack. So any differences occur in the perception and network layer programming.
-If sensor nodes have the capacity to support \gls{ITASK}, a tierless \gls{IOT} system can be constructed in \gls{CLEAN} using only \gls{ITASK}, as in \gls{CRS}. Alternatively for sensor nodes with low computational power, like typical microcontrollers, \gls{MTASK} is used for the perception and network layers, as in \gls{CWS}.
-This section compares the \gls{ITASK} and \gls{MTASK} \glspl{EDSL}, with reference to \gls{CRS} and \gls{CWS} as exemplars. \Cref{table_t4t:languagecomparison} summarises the differences between the \gls{CLEAN}  embedded \gls{IOT} \glspl{EDSL} and their host language.
+If sensor nodes have the capacity to support \gls{ITASK}, a tierless \gls{IOT} system can be constructed in \gls{CLEAN} using only \gls{ITASK}, as in \gls{CRS}. Alternatively for sensor nodes with low computational power, like typical microprocessors, \gls{MTASK} is used for the perception and network layers, as in \gls{CWS}.
+This section compares the \gls{ITASK} and \gls{MTASK} \glspl{EDSL}, with reference to \gls{CRS} and \gls{CWS} as exemplars. \Cref{table_t4t:languagecomparison} summarises the differences between the \gls{CLEAN} embedded \gls{IOT} \glspl{EDSL} and their host language.
 
 \begin{table}
        \small
        \caption{Comparing tierless \gls{IOT} languages for resource-rich sensor nodes (\gls{ITASK} \gls{EDSL}), for resource-constrained sensor nodes (\gls{MTASK} \gls{EDSL}), and their \gls{CLEAN} host language.}%
        \label{table_t4t:languagecomparison}
-       \begin{tabularx}{\textwidth}{lXXX}
+       \begin{tabular}{llll}
                \toprule
                Property & \gls{CLEAN} & \gls{ITASK} & \gls{MTASK}\\
                \midrule
-               Function for an \gls{IOT} System  & Host Language  & Specify distributed workflows & Specify sensor node workflow \\
-           \midrule
+               Function for an \gls{IOT} System  & Host Language  & Specify distri- & Specify sensor\\
+                                                 &                & buted workflows & node workflow \\
+               \midrule
                Referentially transparent   & Yes    & Yes         & Yes \\
-               Evaluation strategy            & Lazy   & Lazy        & Strict\\
+               Evaluation strategy         & Lazy   & Lazy        & Strict\\
                Higher-order functions      & Yes    & Yes         & No \\
                User-defined datatypes      & Yes    & Yes         & No \\
                Task oriented               & No     & Yes         & Yes \\
                Higher-order tasks          & {--}   & Yes         & No \\
-           Execution Target & Commodity PC & Commodity PC and Browser & Microcontroller\\
-           Language Implementation & Compiled or interpreted & Compiled and interpreted & Interpreted\\
+               Execution Target & Commodity PC & Commodity PC & Microprocessor\\
+                                &              & and Browser & Microprocessor\\
+               Language Implementation & Compiled or & Compiled and & Interpreted\\
+                                       & interpreted & interpreted & Interpreted\\
                \bottomrule
-       \end{tabularx}
+       \end{tabular}
 \end{table}
 
-\subsection{Language Restrictions for Resource-Constrained Execution}
+\subsection{Language restrictions for resource-constrained execution}
 
-Executing components on a resource-constrained sensor node imposes restrictions on programming abstractions available in a tierless \gls{IOT} language or \gls{DSL}. The small and fixed-size memory are key limitations. The limitations are shared by any high-level language that targets microcontrollers such as BIT, PICBIT, PICOBIT,  Microscheme and uLisp~\citep{dube_bit:_2000,feeley_picbit:_2003,st-amour_picobit:_2009,suchocki_microscheme:_2015, johnson-davies_lisp_2020}.
-Even in low level languages some language features are disabled by default when targeting microcontrollers, such as runtime type information (RTTI) in \gls{CPP}.
+Executing components on a resource-constrained sensor node imposes restrictions on programming abstractions available in a tierless \gls{IOT} language or \gls{DSL}. The small and fixed-size memory are key limitations. The limitations are shared by any high-level language that targets microprocessors such as BIT, PICBIT, PICOBIT, Microscheme and uLisp~\citep{dube_bit:_2000,feeley_picbit:_2003,st-amour_picobit:_2009,suchocki_microscheme:_2015, johnson-davies_lisp_2020}.
+Even in low level languages some language features are disabled by default when targeting microprocessors, such as runtime type information (RTTI) in \gls{CPP}.
 
-Here we investigate the restrictions imposed by resource-constrained sensor nodes on  \gls{MTASK}, in comparison with \gls{ITASK}. While \gls{ITASK} and \gls{MTASK} are by design superficially similar languages, to execute on resource-constrained sensor nodes \gls{MTASK} tasks are more restricted, and have a different semantics.
+Here we investigate the restrictions imposed by resource-constrained sensor nodes on \gls{MTASK}, in comparison with \gls{ITASK}. While \gls{ITASK} and \gls{MTASK} are by design superficially similar languages, to execute on resource-constrained sensor nodes \gls{MTASK} tasks are more restricted, and have a different semantics.
 
 \Gls{MTASK} programs do not support user defined higher order functions, the only higher order functions available are the predefined \gls{MTASK} combinators.
-Programmers can, however, use any construct of the \gls{CLEAN} host language  to construct an \gls{MTASK} program, including higher order functions and arbitrary data types.  For example folding an \gls{MTASK} combinator over a list of tasks.
+Programmers can, however, use any construct of the \gls{CLEAN} host language to construct an \gls{MTASK} program, including higher order functions and arbitrary data types. For example folding an \gls{MTASK} combinator over a list of tasks.
 The only restriction is that any higher order function must be macro expanded to a first order \gls{MTASK} program before being compiled to byte code.
 %\mlcomment{Pieter: Refine paragraph about macro expansion and currying/HOF}
 As an example in \cref{lst_t4t:mtaskTemp} we use \cleaninline{temperature dht >>~.} \cleaninline{setSds localSds} instead of \cleaninline{temperature dht >>~.} \cleaninline{\\temp -> setSds localSds temp}.
@@ -1128,13 +1123,13 @@ Alleviating this limitation remains future work.
 
 \Gls{MTASK} programs mainly use strict rather than lazy evaluation to minimise the requirement for a variable size heap. This has no significant impact for the \gls{MTASK} programs we have developed here, nor in other \gls{IOT} applications we have engineered.
 
-\Gls{MTASK} abstractions are less easily extended than \gls{ITASK}. For example \gls{ITASK} can be extended with a new combinator that composes a specific set  of tasks for some application.
+\Gls{MTASK} abstractions are less easily extended than \gls{ITASK}. For example \gls{ITASK} can be extended with a new combinator that composes a specific set of tasks for some application.
 Without higher order functions the equivalent combinator can often not be expressed in \gls{MTASK}, and adding it to \gls{MTASK} requires extending the \gls{DSL} rather than writing a new definition in it.
 On the other hand, it is possible to outsource this logic to the \gls{ITASK} program as \gls{MTASK} and \gls{ITASK} tasks are so tightly integrated.
 
-\subsection{The Benefits of a Bare Metal Execution Environment}
+\subsection{The benefits of a bare metal execution environment}
 
-Despite the language restrictions, components of a tierless language executing on a microcontroller can exploit the bare metal environment. Many of these benefits are shared by other bare metal languages like \gls{MICROPYTHON} or \gls{C}\slash\gls{CPP}. So as \gls{MTASK} executes on bare metal it has some advantages over \gls{ITASK}. Most notably \gls{MTASK} has better control of timing as on bare metal there are no other processes or threads that compete for CPU cycles.
+Despite the language restrictions, components of a tierless language executing on a microprocessor can exploit the bare metal environment. Many of these benefits are shared by other bare metal languages like \gls{MICROPYTHON} or \gls{C}\slash\gls{CPP}. So as \gls{MTASK} executes on bare metal it has some advantages over \gls{ITASK}. Most notably \gls{MTASK} has better control of timing as on bare metal there are no other processes or threads that compete for CPU cycles.
 This makes the \gls{MTASK} \cleaninline{repeatEvery} (\cref{lst_t4t:mtaskTemp}, \cref{lst_t4t:mtaskTemp:sn2}) much more accurate than the \gls{ITASK} \cleaninline{waitForTimer} (\cref{lst_t4t:itaskTempFull}, \cref{lst_t4t:itaskTempFull:waitForTimer}).
 While exact timing is not important in this example, it is significant for many other \gls{IOT} applications.
 In contrast \gls{ITASK} cannot give real time guarantees. One reason is that an \gls{ITASK} server can ship an arbitrary number of \gls{ITASK} or \gls{MTASK} tasks to a device.
@@ -1146,16 +1141,16 @@ The \gls{MTASK} \gls{EDSL} and the \gls{MTASK} \gls{RTS} are designed to minimis
 Intensional analysis of the declarative task description and current progress at run time allow the \gls{RTS} to schedule tasks and maximise idle time.
 As the \gls{RTS} is the only program running on the device, it can enforce deep sleep and wake up without having to worry about influencing other processes.
 
-The \gls{MTASK} \gls{RTS} has direct control of the peripherals attached to the microcontroller, e.g.\ over \gls{GPIO} pins. There is no interaction with, or permission required from, the \gls{OS}.
-Moreover, microcontrollers typically have better support for hardware interrupts, reducing the need to poll peripherals.
+The \gls{MTASK} \gls{RTS} has direct control of the peripherals attached to the microprocessor, e.g.\ over \gls{GPIO} pins. There is no interaction with, or permission required from, the \gls{OS}.
+Moreover, microprocessors typically have better support for hardware interrupts, reducing the need to poll peripherals.
 The downside of this direct control is that \gls{CWS} has to handle some exceptions that would otherwise be handled by the \gls{OS} in \gls{CRS} and hence the device management code is longer: 28 versus 20 \gls{SLOC} in \cref{table_t4t:multi}.
 
 \subsection{Summary}
 
 \Cref{table_t4t:languagecomparison} summarises the differences between the \gls{CLEAN} \gls{IOT} \gls{EDSL} and their host language.
-The restrictions imposed by a resource-constrained execution environment on the tierless \gls{IOT} language are relatively minor. Moreover the \gls{MTASK} programming abstraction is broadly compatible with \gls{ITASK}. As a simple example compare the \gls{ITASK} and \gls{MTASK} temperature sensors in \cref{lst_t4t:itaskTempFull,lst_t4t:mtaskTemp}. As a more realistic example, the \gls{MTASK} based \gls{CWS} smart campus implementation is similar to the \gls{ITASK} based \gls{CRS}, and requires less than 10\% additional code: 166 \gls{SLOC} compared with  155 \gls{SLOC} (\cref{table_t4t:multi}).
+The restrictions imposed by a resource-constrained execution environment on the tierless \gls{IOT} language are relatively minor. Moreover the \gls{MTASK} programming abstraction is broadly compatible with \gls{ITASK}. As a simple example compare the \gls{ITASK} and \gls{MTASK} temperature sensors in \cref{lst_t4t:itaskTempFull,lst_t4t:mtaskTemp}. As a more realistic example, the \gls{MTASK} based \gls{CWS} smart campus implementation is similar to the \gls{ITASK} based \gls{CRS}, and requires less than 10\% additional code: 166 \gls{SLOC} compared with 155 \gls{SLOC} (\cref{table_t4t:multi}).
 
-Even with these restrictions, \gls{MTASK} programming is at a far higher level of abstraction than almost all bare metal languages, e.g.\ BIT, PICBIT, PICOBIT and Microscheme. That is \gls{MTASK} provides a set of higher order task combinators, shared distributed data stores, etc. (\cref{sec_t4t:mtasks}).  Moreover, it seems that common sensor node programs are readily expressed using  \gls{MTASK}. In addition to the \gls{CWTS} and \gls{CWS} systems outlined here, other case studies include Arduino examples as well as some bigger tasks~\citep{koopman_task-based_2018,lubbers_writing_2019,LubbersMIPRO}. We conclude that the programming of sensor tasks is well-supported by both \glspl{DSL}.
+Even with these restrictions, \gls{MTASK} programming is at a far higher level of abstraction than almost all bare metal languages, e.g.\ BIT, PICBIT, PICOBIT and Microscheme. That is \gls{MTASK} provides a set of higher order task combinators, shared distributed data stores, etc. (\cref{sec_t4t:mtasks}). Moreover, it seems that common sensor node programs are readily expressed using \gls{MTASK}. In addition to the \gls{CWTS} and \gls{CWS} systems outlined here, other case studies include Arduino examples as well as some bigger tasks~\citep{koopman_task-based_2018,lubbers_writing_2019,LubbersMIPRO}. We conclude that the programming of sensor tasks is well-supported by both \glspl{DSL}.
 
 \section{Conclusion}%
 \label{sec_t4t:Conclusion}
@@ -1165,7 +1160,7 @@ Even with these restrictions, \gls{MTASK} programming is at a far higher level o
 
 We have conducted a systematic comparative evaluation of two tierless language technologies for \gls{IOT} stacks: one for resource-rich, and the other for resource-constrained sensor nodes. The basis is four implementations of a deployed smart campus \gls{IOT} stack: two conventional tiered and \gls{PYTHON}-based stacks, and two tierless \gls{CLEAN} stacks. An operational comparison of implementations demonstrates that they have equivalent functionality, and meet the \gls{UOG} smart campus functional requirements (\cref{sec_t4t:Case}).
 
-We show that \emph{tierless languages have the potential to significantly reduce the development effort for  \gls{IOT} systems}. Specifically the tierless \gls{CWS} and \gls{CRS} stacks require far less code, i.e.\ 70\% fewer \gls{SLOC}, than the tiered \gls{PWS} and \gls{PRS} stacks (\cref{table_t4t:multi}). We analyse the code reduction and attribute it to the following three main factors.
+We show that \emph{tierless languages have the potential to significantly reduce the development effort for \gls{IOT} systems}. Specifically the tierless \gls{CWS} and \gls{CRS} stacks require far less code, i.e.\ 70\% fewer \gls{SLOC}, than the tiered \gls{PWS} and \gls{PRS} stacks (\cref{table_t4t:multi}). We analyse the code reduction and attribute it to the following three main factors.
 \begin{enumerate*}
        \item Tierless developers need to manage less interoperation: \gls{CRS} uses a single \gls{DSL} and paradigm, and \gls{CWS} uses two \glspl{DSL} in a single paradigm and three source code files. In contrast, both \gls{PRS} and \gls{PWS} use at least six languages in two paradigms and spread over at least 35 source code files (\cref{table_t4t:multi,table_t4t:languages,table_t4t:paradigms}). Thus, a tierless stack minimises semantic friction.
        \item Tierless developers benefit from automatically generated, and hence correct, communication (\cref{lst_t4t:mtaskTemp}), and write 6$\times$ less communication code (\cref{fig_t4t:multipercentage}).
@@ -1174,8 +1169,8 @@ We show that \emph{tierless languages have the potential to significantly reduce
 Our empirical results for \gls{IOT} systems are consistent with the benefits claimed for tierless languages in other application domains. Namely that a tierless language provides a \textit{Higher Abstraction Level}, \textit{Improved Software Design}, and improved \textit{Program Comprehension}~\citep{weisenburger2020survey}.
 \end{enumerate*}
 
-We show that \emph{tierless languages have the potential to significantly improve the reliability of \gls{IOT} systems}.  We illustrate how \gls{CLEAN} maintains type safety, contrasting this with a loss of type safety in \gls{PRS}.
-We illustrate higher order failure management in \gls{CLEAN}\slash\gls{ITASK}/\gls{MTASK} in contrast to the \gls{PYTHON}-based failure management in  \gls{PRS}. For maintainability a tiered approach makes replacing components easy, but refactoring within the components is far harder than in a tierless \gls{IOT} language. Again our findings are consistent with the simplied \textit{Code Maintenance}  benefits claimed for tierless languages~\citep{weisenburger2020survey}.
+We show that \emph{tierless languages have the potential to significantly improve the reliability of \gls{IOT} systems}. We illustrate how \gls{CLEAN} maintains type safety, contrasting this with a loss of type safety in \gls{PRS}.
+We illustrate higher order failure management in \gls{CLEAN}\slash\gls{ITASK}/\gls{MTASK} in contrast to the \gls{PYTHON}-based failure management in \gls{PRS}. For maintainability a tiered approach makes replacing components easy, but refactoring within the components is far harder than in a tierless \gls{IOT} language. Again our findings are consistent with the simplied \textit{Code Maintenance} benefits claimed for tierless languages~\citep{weisenburger2020survey}.
 Finally, we contrast community support for the technologies (\cref{sec_t4t:Discussion}).
 
 %\pwtcomment{Pieter: please check discussion of ~\citep{weisenburger2020survey} in preceding 2 paragraphs}
@@ -1187,8 +1182,8 @@ We report \emph{the first comparison of a tierless \gls{IOT} codebase for resour
 as it is in the tiered \gls{PYTHON} implementations (\cref{fig_t4t:multipercentage}). This suggests that the code for resource-constrained and resource-rich sensor nodes can be broadly similar in tierless technologies, as it is in many tiered technologies (\cref{sec_t4t:resourcerich}).
 \end{enumerate*}
 
-We present \emph{the first comparison of two tierless \gls{IOT} languages: one designed for resource-constrained sensor nodes (\gls{CLEAN} with \gls{ITASK} and \gls{MTASK}), and the other for resource-rich sensor nodes (\gls{CLEAN} with \gls{ITASK}).}  \gls{CLEAN}\slash\gls{ITASK} can implement all layers of the \gls{IOT} stack if the sensor nodes have the computational resources, as the Raspberry Pis do in \gls{CRS}. On resource constrained sensor nodes \gls{MTASK} are required to implement the perception and network layers, as on the Wemos minis in \gls{CWS}. We show that a bare metal execution environment allows \gls{MTASK} to have better control of peripherals, timing and energy consumption. The memory available on a microcontroller restricts the  programming abstractions available in \gls{MTASK} to a fixed set of combinators, no user defined or recursive data types,  strict evaluation, and makes it harder to add new abstractions. Even with these restrictions \gls{MTASK} provide a higher level of abstraction than most bare metal languages, and can  readily express many \gls{IOT} applications including the \gls{CWS} \gls{UOG} smart campus application (\cref{sec_t4t:ComparingTierless}).
-Our empirical results are consistent with the  benefits of tierless languages listed in Section 2.1 of~\citep{weisenburger2020survey}.
+We present \emph{the first comparison of two tierless \gls{IOT} languages: one designed for resource-constrained sensor nodes (\gls{CLEAN} with \gls{ITASK} and \gls{MTASK}), and the other for resource-rich sensor nodes (\gls{CLEAN} with \gls{ITASK}).} \gls{CLEAN}\slash\gls{ITASK} can implement all layers of the \gls{IOT} stack if the sensor nodes have the computational resources, as the Raspberry Pis do in \gls{CRS}. On resource constrained sensor nodes \gls{MTASK} are required to implement the perception and network layers, as on the Wemos minis in \gls{CWS}. We show that a bare metal execution environment allows \gls{MTASK} to have better control of peripherals, timing and energy consumption. The memory available on a microprocessor restricts the programming abstractions available in \gls{MTASK} to a fixed set of combinators, no user defined or recursive data types, strict evaluation, and makes it harder to add new abstractions. Even with these restrictions \gls{MTASK} provide a higher level of abstraction than most bare metal languages, and can readily express many \gls{IOT} applications including the \gls{CWS} \gls{UOG} smart campus application (\cref{sec_t4t:ComparingTierless}).
+Our empirical results are consistent with the benefits of tierless languages listed in Section 2.1 of~\citep{weisenburger2020survey}.
 
 \subsection{Reflections} 
 
@@ -1196,10 +1191,10 @@ This study is based on a specific pair of tierless \gls{IOT} languages, and the
 
 This study has explored some, but not all, of the potential benefits of tierless languages for \gls{IOT} systems. An \gls{IOT} system specified as a single tierless program is amenable to a host of programming language technologies. For example, if the language has a formal semantics, as Links, Hop and \gls{CLEAN} tasks do~\citep{cooper2006links,serrano2006hop,plasmeijer_task-oriented_2012}, it is possible to prove properties of the system, e.g.\ \citep{Steenvoorden2019tophat}. As another example program analyses can be applied, and \cref{sec_t4t:characteristics} and~\citep{weisenburger2020survey} outline some of the analyses could be, and in some cases have been, used to improve \gls{IOT} systems. Examples include automatic tier splitting~\citep{10.1145/2661136.2661146}, and controlling information flow to enhance security~\citep{valliappan_towards_2020}. 
 
-While offering real benefits for \gls{IOT} systems development, tierless languages also raise some challenges. Programmers must master new tierless programming abstractions, and the semantics of these automatic multi-tier behaviours are necessarily relatively complex. In the \gls{CLEAN} context this entails becoming proficient with the  \gls{ITASK} and \gls{MTASK} \glspl{DSL}. Moreover, specifying a behaviour that is not already provided by the tierless language requires either a workaround, or extending a \gls{DSL}. However, implementing the relatively simple smart campus application required no such adaption. Finally, tierless \gls{IOT} technology is very new, and both tool and community support have yet to mature.
+While offering real benefits for \gls{IOT} systems development, tierless languages also raise some challenges. Programmers must master new tierless programming abstractions, and the semantics of these automatic multi-tier behaviours are necessarily relatively complex. In the \gls{CLEAN} context this entails becoming proficient with the \gls{ITASK} and \gls{MTASK} \glspl{DSL}. Moreover, specifying a behaviour that is not already provided by the tierless language requires either a workaround, or extending a \gls{DSL}. However, implementing the relatively simple smart campus application required no such adaption. Finally, tierless \gls{IOT} technology is very new, and both tool and community support have yet to mature.
 
 
-\subsection{Future Work}
+\subsection{Future work}
 
 This paper is a technology comparison between tiered and tierless technologies. The metrics reported, such as code size, numbers of source code files, and of paradigms are only indirect, although widely accepted, measures of development effort. A more convincing evaluation of tierless technologies could be provided by conducting a carefully designed and substantial user study, e.g.\ using N-version programming.