update listing, polish arch, dsl and top
[msc-thesis1617.git] / methods.top.tex
1 \section{\acrlong{TOP}}
2 \subsection{\gls{iTasks}}
3 \gls{TOP} is a recent new programming paradigm implemented as
4 \gls{iTasks}\cite{achten_introduction_2015} in the pure lazy functional
5 language \gls{Clean}\cite{brus_cleanlanguage_1987}. \gls{iTasks} is a
6 \gls{EDSL} to model workflow tasks in the broadest sense. A \CI{Task} is just
7 a function that, given some state, returns the observable \CI{TaskValue}. The
8 \CI{TaskValue} of a \CI{Task} can have different states. Not all state
9 transitions are possible as shown in Figure~\ref{fig:taskvalue}. Once a value
10 has gone stable it can never become unstable again. Stability is often reached
11 by pressing a confirmation button or for \glspl{Task} that offer a constant
12 value. A simple example is shown in Listing~\ref{lst:taskex} accompanied with
13 Figure~\ref{fig:taskex1},~\ref{fig:taskex2} and~\ref{fig:taskex3}. In this
14 example the first image in is the \CI{NoValue} state, the second and third
15 image are in the \CI{Unstable} state. When the user presses \emph{Continue} the
16 value becomes \CI{Stable}.
17
18 \begin{figure}[H]
19 \centering
20 \includegraphics[width=.5\linewidth]{fig-taskvalue}
21 \caption{The states of a \CI{TaskValue}}\label{fig:taskvalue}
22 \end{figure}
23
24 \begin{lstlisting}[language=Clean,label={lst:taskex},%
25 caption={An example \gls{Task} for entering a name}]
26 :: Name = { firstname :: String
27 , lastname :: String
28 }
29
30 derive class iTask Name
31
32 enterInformation :: String [EnterOption m] -> (Task m) | iTask m
33
34 enterName :: Task Name
35 enterName = enterInformation "Enter your name" []
36 \end{lstlisting}
37
38 \begin{figure}[H]
39 \begin{subfigure}{.25\textwidth}
40 \centering
41 \includegraphics[width=.9\linewidth]{taskex1}
42 \caption{Initial interface}\label{fig:taskex1}
43 \end{subfigure}
44 \begin{subfigure}{.25\textwidth}
45 \centering
46 \includegraphics[width=.9\linewidth]{taskex2}
47 \caption{Incomplete entrance}\label{fig:taskex2}
48 \end{subfigure}
49 \begin{subfigure}{.25\textwidth}
50 \centering
51 \includegraphics[width=.9\linewidth]{taskex3}
52 \caption{Complete entry}\label{fig:taskex3}
53 \end{subfigure}
54 \caption{Example of a generated user interface}
55 \end{figure}
56
57 For a type to be suitable it must have instances for a collection of generic
58 functions that are captured in the class \CI{iTask}. Basic types have
59 specialization instances for these functions and show an according interface.
60 Generated interfaces can be modified with decoration operators.
61
62 \subsection{Combinators}
63 \todo{Stukje over combinators, in ieder geval bind en paralel}