1 \section{\acrlong{TOP
}}
2 \gls{TOP
} is a recent new programming paradigm implemented as
3 \gls{iTasks
}\cite{achten_introduction_2015
} in the pure lazy functional
4 language
\gls{Clean
}\cite{brus_cleanlanguage_1987
}.
\gls{iTasks
} is a
5 \gls{EDSL
} to model workflow tasks in the broadest sense. A
\CI{Task
} is just
6 a function that, given some state, returns the observable value of the
7 \CI{TaskValue
}. A simple example is shown in Listing~
\ref{lst:taskex
}
8 accompanied with Figure~
\ref{fig:taskex1
},~
\ref{fig:taskex2
} and~
%
11 \begin{lstlisting
}[language=Clean,label=
{lst:taskex
},
%
12 caption=
{An example
\gls{Task
} for entering a name
}]
13 :: Name =
{ firstname :: String
17 derive class iTask Name
19 enterInformation :: String
[EnterOption m
] -> (Task m) | iTask m
21 enterName :: Task Name
22 enterName = enterInformation "Enter your name"
[]
26 \begin{subfigure
}{.25\textwidth}
28 \includegraphics[width=
.9\linewidth]{taskex1
}
29 \caption{Initial interface
}\label{fig:taskex1
}
31 \begin{subfigure
}{.25\textwidth}
33 \includegraphics[width=
.9\linewidth]{taskex2
}
34 \caption{Incomplete entrance
}\label{fig:taskex2
}
36 \begin{subfigure
}{.25\textwidth}
38 \includegraphics[width=
.9\linewidth]{taskex3
}
39 \caption{Complete entry
}\label{fig:taskex3
}
41 \caption{Example of a generated user interface
}
44 \section{\acrlong{EDSL
}s
}
45 \glspl{mTask
} are expressed in a class based shallowly embedded
\gls{EDSL
}.
46 There are two main types of
\glspl{EDSL
}.
47 \todo{Small shallow embedded dsl intro
}
48 \todo{Small deep embedded dsl
}
49 \todo{Show that class based has the best of both worlds
}
51 \section{Architecture
}
54 The client code for the devices is compiled from one codebase. For a device to
55 be eligible for
\glspl{mTask
} it must be able to compile the shared codebase
56 and implement (part of) the device specific interface. The shared codebase only
57 uses standard
\gls{C
} and no special libraries or tricks are used. Therefore
58 the code is compilable for almost any device or system. Note that it is not
59 needed to implement a full interface
\todo{handshake
}. The full interface,
60 listed in Appendix~
\label{app:device-interface
}\todo{update interface listing
},
61 also includes functions for accessing the peripherals that not every device
62 might have. Devices can choose what to implement by setting the correct macros
63 in the top of the file.
64 \todo{Supported devices
}
66 \subsection{Specification
}
67 Devices are stored in a record type and all devices in the system are stored in
68 a
\gls{SDS
} containing all devices. From the macro settings in the interface
69 file a profile is created for the device that describes the specification. When
70 a connection between the server and a client is established the server will
71 send a request for specification. The client will serialize his specs and send
72 it to the server so that the server knows what the client is capable of. The
73 exact specification is listed in Listing~
\ref{lst:devicespec
}
75 \begin{lstlisting
}[language=Clean,label=
{lst:devicespec
},
76 caption=
{Device specification for
\glspl{mTask
}}]
81 ,taskSpace :: Int // Bytes
82 ,sdsSpace :: Int // Bytes
85 \todo{Explain specification, combine task and share space
}
87 \subsection{Communication
}
90 \subsection{\gls{EDSL
}}
91 The
\gls{mTask
}-
\gls{EDSL
} contains several classes that need to be implemented
92 by a type for it to be an
\gls{mTask
}. For numeric and boolean arithmetic the
93 classes
\texttt{arith
} and
\texttt{boolExpr
} are available and listed in a
94 shortened version in Listing~
\ref{lst:arithbool
}. All classes are to be
95 implemented by types of kind
\texttt{*->*->*
} a type
\texttt{v t p
},
96 respectively a view with a type and the role.
98 \texttt{lit
} lifts a constant to the
\gls{mTask
} domain. For a type to be a
99 valid
\gls{mTask
} type it needs to implement the
\texttt{mTaskType
} class. The
100 binary operators work as expected.
102 \begin{lstlisting
}[language=Clean,label=
{lst:arithbool
},
103 caption=
{Basic classes for expressions
}]
104 class mTaskType a | toByteCode, fromByteCode, iTask, TC a
107 lit :: t -> v t Expr | mTaskType t
108 (+.) infixl
6 :: (v t p) (v t q) -> v t Expr | type, +, zero t & isExpr p & isExpr q
110 class boolExpr v where
111 (&.) infixr
3 :: (v Bool p) (v Bool q) -> v Bool Expr | isExpr p & isExpr q
112 Not :: (v Bool p) -> v Bool Expr | isExpr p
114 (==.) infix
4 :: (v a p) (v a q) -> v Bool Expr | ==, toCode a & isExpr p & isExpr q
121 Shares can live on multiple clients at the same time. For every share created
122 for an
\gls{mTask
} a real
\gls{SDS
} is created that mirrors the value on the
123 client. All shares currently in use are stored in a system-wide
\gls{SDS
} in
124 such a way that the actual share can be retrieved at any moment. All shares
125 have a unique numeric identifier and an initial value.
127 \begin{lstlisting
}[language=Clean,label=
{lst:sharespec
}, caption=
{\acrlong{SDS
}}]
128 :: BCValue = E.e: BCValue e & mTaskType e
129 :: MTaskShareType = MTaskWithShare String | MTaskLens String
131 {withTask ::
[String
]
132 ,withDevice ::
[String
]
134 ,realShare :: MTaskShareType
138 sdsStore :: Shared
[MTaskShare
]
140 \todo{Do something with the sharetype
}
142 \subsection{Communication
}
143 %\todo{Handshake, device specification sending, spec.c}
144 %\todo{mTaskDevice class interface}
147 \subsection{\gls{EDSL
}}
148 \todo{Show the classes
}
151 \todo{Show the types and why
}
153 Shares are used to store the values