From b039340842965c6b4bc4abe0f6485cf71c9f8935 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Tue, 2 May 2017 13:35:32 +0200 Subject: [PATCH] add taskvalue graph and split up methods --- .gitignore | 1 + Makefile | 11 +++++--- abstract.tex | 8 +++--- fig/fig-taskvalue.dot | 7 +++++ methods.dsl.tex | 7 +++++ methods.tex | 54 ++----------------------------------- methods.top.tex | 63 +++++++++++++++++++++++++++++++++++++++++++ thesis.pre | 3 ++- 8 files changed, 94 insertions(+), 60 deletions(-) create mode 100644 fig/fig-taskvalue.dot create mode 100644 methods.dsl.tex create mode 100644 methods.top.tex diff --git a/.gitignore b/.gitignore index 8df797c..bd7a20d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ *.tdo *.toc *.xdy +img/fig-* diff --git a/Makefile b/Makefile index 9c08e6e..eadae05 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,10 @@ MAKEGLOSSARIES?=makeglossaries MAKEGLOSSARIESFLAGS?= LATEXFLAGS:=-file-line-error -halt-on-error -no-shell-escape +FIGURES:=$(addsuffix .png,$(addprefix img/,$(notdir $(basename $(wildcard fig/*.dot))))) + .PHONY: all clean -.SECONDARY: $(addsuffix .fmt,$(DOCS)) +.SECONDARY: $(addsuffix .fmt,$(DOCS)) $(FIGURES) all: $(addsuffix .pdf,$(DOCS)) @@ -18,13 +20,16 @@ all: $(addsuffix .pdf,$(DOCS)) %.pdf: %.mlog if $(GREP) -iFq 'Rerun' $<; then $(LATEX) $(LATEXFLAGS) $(basename $<); fi -%.mlog: %.tex %.fmt $(wildcard *.bib) $(wildcard *.tex) +%.mlog: %.tex %.fmt $(wildcard *.bib) $(wildcard *.tex) $(FIGURES) $(LATEX) $(LATEXFLAGS) $< if $(GREP) -q '^\\bibdata{' $(basename $<).aux; then $(BIBTEX) $(BIBTEXFLAGS) $(basename $<); fi if $(GREP) -q '\@istfilename' $(basename $<).aux; then $(MAKEGLOSSARIES) $(MAKEGLOSSARIESFLAGSFLAGS) $(basename $<); fi $(LATEX) $(LATEXFLAGS) $< | tee $@ +img/%.png: fig/%.dot + dot -Tpng $< > $@ + clean: $(RM) $(foreach DOC,$(DOCS),$(addprefix $(DOC).,\ acn acr alg aux bbl blg fmt glg glo gls ist lof log lol lot nav out\ - pdf run.xml snm tdo toc vrb xdy)) + pdf run.xml snm tdo toc vrb xdy)) $(FIGURES) diff --git a/abstract.tex b/abstract.tex index aba9886..5030daf 100644 --- a/abstract.tex +++ b/abstract.tex @@ -1,7 +1,7 @@ This thesis presents a way to connect small \gls{IoT} devices with high level \gls{TOP} implementations languages. It shows how a new frontend for the class -based shallowly embedded \glspl{EDSL} called \gls{mTask} written in \gls{Clean} +based shallowly \glspl{EDSL} called \gls{mTask} written in \gls{Clean} can be used to compile \gls{IoT}-tasks on the fly and send them to the device -as bytecode which is interpreted. All of this adheres to the \gls{TOP} -philosophy where familiar concepts such as \glspl{SDS} and task-combinators are -available at ease. +as interpretable bytecode. All of this adheres to the \gls{TOP} philosophy +where familiar concepts such as \glspl{SDS} and task-combinators are available +at ease. diff --git a/fig/fig-taskvalue.dot b/fig/fig-taskvalue.dot new file mode 100644 index 0000000..1cd3915 --- /dev/null +++ b/fig/fig-taskvalue.dot @@ -0,0 +1,7 @@ +digraph { + graph [ dpi = 600 ]; + rankdir=LR; + "NoValue" -> "Unstable"; + "Unstable" -> "Stable"; + "Unstable" -> "NoValue"; +} diff --git a/methods.dsl.tex b/methods.dsl.tex new file mode 100644 index 0000000..50a5138 --- /dev/null +++ b/methods.dsl.tex @@ -0,0 +1,7 @@ +\section{\acrlong{EDSL}s} +\todo{while iTasks is also a DSL\ldots} +\glspl{mTask} are expressed in a class based shallowly embedded \gls{EDSL}. +There are two main types of \glspl{EDSL}. +\todo{Small shallow embedded dsl intro} +\todo{Small deep embedded dsl} +\todo{Show that class based has the best of both worlds} diff --git a/methods.tex b/methods.tex index 1cf3b68..7850c82 100644 --- a/methods.tex +++ b/methods.tex @@ -1,56 +1,6 @@ -\section{\acrlong{TOP}} -\subsection{\gls{iTasks}} -\gls{TOP} is a recent new programming paradigm implemented as -\gls{iTasks}\cite{achten_introduction_2015} in the pure lazy functional -language \gls{Clean}\cite{brus_cleanlanguage_1987}. \gls{iTasks} is a -\gls{EDSL} to model workflow tasks in the broadest sense. A \CI{Task} is just -a function that, given some state, returns the observable value of the -\CI{TaskValue}. A simple example is shown in Listing~\ref{lst:taskex} -accompanied with Figure~\ref{fig:taskex1},~\ref{fig:taskex2} and~% -\ref{fig:taskex3}. - -\begin{lstlisting}[language=Clean,label={lst:taskex},% - caption={An example \gls{Task} for entering a name}] -:: Name = { firstname :: String - , lastname :: String - } - -derive class iTask Name - -enterInformation :: String [EnterOption m] -> (Task m) | iTask m - -enterName :: Task Name -enterName = enterInformation "Enter your name" [] -\end{lstlisting} +\input{methods.top.tex} -\begin{figure}[H] - \begin{subfigure}{.25\textwidth} - \centering - \includegraphics[width=.9\linewidth]{taskex1} - \caption{Initial interface}\label{fig:taskex1} - \end{subfigure} - \begin{subfigure}{.25\textwidth} - \centering - \includegraphics[width=.9\linewidth]{taskex2} - \caption{Incomplete entrance}\label{fig:taskex2} - \end{subfigure} - \begin{subfigure}{.25\textwidth} - \centering - \includegraphics[width=.9\linewidth]{taskex3} - \caption{Complete entry}\label{fig:taskex3} - \end{subfigure} - \caption{Example of a generated user interface} -\end{figure} - -\subsection{Combinators} - -\section{\acrlong{EDSL}s} -\todo{while iTasks is also a DSL\ldots} -\glspl{mTask} are expressed in a class based shallowly embedded \gls{EDSL}. -There are two main types of \glspl{EDSL}. -\todo{Small shallow embedded dsl intro} -\todo{Small deep embedded dsl} -\todo{Show that class based has the best of both worlds} +\input{methods.dsl.tex} \section{Architecture} \subsection{Devices} diff --git a/methods.top.tex b/methods.top.tex new file mode 100644 index 0000000..cbf65eb --- /dev/null +++ b/methods.top.tex @@ -0,0 +1,63 @@ +\section{\acrlong{TOP}} +\subsection{\gls{iTasks}} +\gls{TOP} is a recent new programming paradigm implemented as +\gls{iTasks}\cite{achten_introduction_2015} in the pure lazy functional +language \gls{Clean}\cite{brus_cleanlanguage_1987}. \gls{iTasks} is a +\gls{EDSL} to model workflow tasks in the broadest sense. A \CI{Task} is just +a function that, given some state, returns the observable \CI{TaskValue}. The +\CI{TaskValue} of a \CI{Task} can have different states. Not all state +transitions are possible as shown in Figure~\ref{fig:taskvalue}. Once a value +has gone stable it can never become unstable again. Stability is often reached +by pressing a confirmation button or for \glspl{Task} that offer a constant +value. A simple example is shown in Listing~\ref{lst:taskex} accompanied with +Figure~\ref{fig:taskex1},~\ref{fig:taskex2} and~\ref{fig:taskex3}. In this +example the first image in is the \CI{NoValue} state, the second and third +image are in the \CI{Unstable} state. When the user presses \emph{Continue} the +value becomes \CI{Stable}. + +\begin{figure}[H] + \centering + \includegraphics[width=.5\linewidth]{fig-taskvalue} + \caption{The states of a \CI{TaskValue}}\label{fig:taskvalue} +\end{figure} + +\begin{lstlisting}[language=Clean,label={lst:taskex},% + caption={An example \gls{Task} for entering a name}] +:: Name = { firstname :: String + , lastname :: String + } + +derive class iTask Name + +enterInformation :: String [EnterOption m] -> (Task m) | iTask m + +enterName :: Task Name +enterName = enterInformation "Enter your name" [] +\end{lstlisting} + +\begin{figure}[H] + \begin{subfigure}{.25\textwidth} + \centering + \includegraphics[width=.9\linewidth]{taskex1} + \caption{Initial interface}\label{fig:taskex1} + \end{subfigure} + \begin{subfigure}{.25\textwidth} + \centering + \includegraphics[width=.9\linewidth]{taskex2} + \caption{Incomplete entrance}\label{fig:taskex2} + \end{subfigure} + \begin{subfigure}{.25\textwidth} + \centering + \includegraphics[width=.9\linewidth]{taskex3} + \caption{Complete entry}\label{fig:taskex3} + \end{subfigure} + \caption{Example of a generated user interface} +\end{figure} + +For a type to be suitable it must have instances for a collection of generic +functions that are captured in the class \CI{iTask}. Basic types have +specialization instances for these functions and show an according interface. +Generated interfaces can be modified with decoration operators. + + +\subsection{Combinators} diff --git a/thesis.pre b/thesis.pre index 9ec3c0a..f0b453b 100644 --- a/thesis.pre +++ b/thesis.pre @@ -100,7 +100,8 @@ showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces' showstringspaces=false, % underline spaces within strings only showtabs=false, % show tabs within strings adding particular underscores - tabsize=4 % sets default tabsize to 2 spaces + tabsize=4, % sets default tabsize to 2 spaces + frame=L } \title{iTasks and the Internet of Things} -- 2.20.1