3 \frametitle{Current state of mTask
}
5 \item It all seems perfect
6 \item \ldots\pause{} but
\ldots
9 \item Compilation requires reprogramming
10 \item Entire system is created and fixed
17 \item New bytecode backend for mTask
18 \item Interpreter on client
19 \item Server in iTasks with integration
20 \item No taskserver generation, onetime programming
21 \item Dynamic task sending
22 \item Explicit SDS publishing
26 \subsection{Extending mTask
}
27 \begin{frame
}[fragile
]
28 \frametitle{Adding a View
}
29 \begin{lstlisting
}[language=Clean
]
30 :: ByteCode a p = BC (RWS ()
[BC
] BCState ())
31 :: BC = BCNop | BCPush BCValue | ...
32 :: BCValue = E.e: BCValue e & mTaskType, TC e
33 :: BCShare =
{ sdsi :: Int, sdsval :: BCValue, sdsname :: String
}
34 :: BCState =
{ freshl :: Int, freshs :: Int, sdss ::
[BCShare
] }
36 instance ByteCode arith, boolExpr, ...
40 \begin{frame
}[fragile
]
41 \frametitle{Implementation
}
43 \item Writing instruction
45 \item Hand-crafted helpers
47 \begin{lstlisting
}[language=Clean
]
48 op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr
49 op2 (BC x) (BC y) bc = BC (x >>| y >>| tell
[bc
])
51 tell2 ::
[BC
] -> (ByteCode a p)
54 instance arith ByteCode where
55 lit x = tell2
[BCPush (BCValue x)
]
56 (+.) x y = op2 x y BCDiv
61 \begin{frame
}[fragile
]
62 \frametitle{Control flow
}
70 \begin{lstlisting
}[language=Clean
]
71 :: BC = ... | BCLab Int | ...
73 freshlabel = get >>=
\st=:
{freshl
}->put
{st & freshl=freshl+
1} >>| pure freshl
75 instance If ByteCode Stmt Stmt Stmt where If b t e = BCIfStmt b t e
77 BCIfStmt (BC b) (BC t) (BC e) = BC (
78 freshlabel >>=
\else->freshlabel >>=
\endif->
79 b >>| tell
[BCJmpF else
] >>|
80 t >>| tell
[BCJmp endif, BCLab else
] >>|
81 e >>| tell
[BCLab endif
]
86 %\begin{frame}[fragile]
87 % \frametitle{Functionality}
88 % \begin{block}{SDS scope and naming}
91 % \item State per device
92 % \item Tasks are sent and gone
96 %class namedsds v where
97 % namedsds :: ((v t Upd) -> In (Named t String) (Main (v c s)))
98 % -> (Main (v c s)) | ...
99 %:: Named a b = Named infix 1 a b
101 %instance sdspub ByteCode where
102 % pub (BC x) = BC (censor (\[BCSdsFetch s]->[BCSdsPublish s]) x)
107 \begin{frame
}[fragile
]
108 \frametitle{Assignment
}
109 \begin{lstlisting
}[language=Clean
]
110 instance sds ByteCode where
111 sds f =
{main = BC (freshshare
112 >>=
\sdsi->pure
{BCShare|sdsname="",sdsi=sdsi,sdsval=BCValue
0}
113 >>=
\sds->pure (f (tell2
[BCSdsFetch sds
]))
114 >>= \(v In bdy)->modify (addSDS sds v)
115 >>| unBC (unMain bdy))
118 instance assign ByteCode where
119 (=.) (BC v) (BC e) = BC (e >>| censor makeStore v)
121 instance sdspub ByteCode where
122 pub (BC x) = BC (censor (\
[BCSdsFetch s
]->
[BCSdsPublish s
]) x)
124 makeStore
[BCSdsFetch i
] =
[BCSdsStore i
]
125 makeStore
[BCDigitalRead i
] =
[BCDigitalWrite i
]
126 makeStore
[...
] =
[...
]
130 \begin{frame
}[fragile
]
131 \frametitle{Task scheduling
}
135 \item Tasks start other tasks
141 \item Old system, taskserver, tasks start tasks
142 \item New system, task+strategy
146 \item \CI{OnInterval
}
147 \item \CI{OnInterrupt
}
150 \item How to handle termination
153 \begin{lstlisting
}[language=Clean
]
160 \subsection{Interpretation
}
161 \begin{frame
}[fragile
]
162 \frametitle{mTask implementation
}
171 \item Implement some classes in interface
173 \item How to handle termination
178 \begin{frame
}[fragile
]
180 \framesubtitle{Parametric Lenses
}
181 \begin{block
}{What is the
\CI{p
} for in
\CI{RWShared p r w
}}
184 \item Parameter fixed when writing
185 \item Used for notifications
186 \item On write the SDS returns
\CI{p -> Bool
}
191 %sdsFocus :: p1 (RWShared p1 r w) -> RWShared p2 r w | iTask p
193 %:: SDSNotifyPred p :== p -> Bool
194 %:: SDSLensRead p r rs = SDSRead (p -> rs -> MaybeError TaskException r)
195 % | SDSReadConst (p -> r)
196 %:: SDSLensWrite p w rs ws = SDSWrite (p -> rs -> w -> MaybeError TaskException (Maybe ws))
197 % | SDSWriteConst (p -> w -> MaybeError TaskException (Maybe ws))
198 %:: SDSLensNotify p w rs = SDSNotify (p -> rs -> w -> SDSNotifyPred p)
199 % | SDSNotifyConst (p -> w -> SDSNotifyPred p)
201 %sdsLens :: String (p -> ps) (SDSLensRead p r rs) (SDSLensWrite p w rs ws)
202 % (SDSLensNotify p w rs) (RWShared ps rs ws) -> RWShared p r w | iTask ps
205 \subsection{Examples
}