\begin{lstlisting}[caption={Device type},label={lst:mtaskdevice}]
:: Channels :== ([MTaskMSGRecv], [MTaskMSGSend], Bool)
-:: BCState = ... // Compiler state, explained in later sections
:: MTaskDeviceSpec = ... // Also explained in later sections
:: MTaskMSGRecv = ... // Message format, explained in later sections
:: MTaskMSGSend = ... // Also explained in later sections
\begin{lstlisting}[label={lst:actualdev},%
caption={Device \gls{SDS}}]
+($<) :: a (f a) -> (f b)
($<) a fb = fmap (const a) fb
deviceStore :: RWShared (Maybe (MTaskDevice, Int)) [MTaskDevice] [MTaskDevice]
\begin{lstlisting}[caption={Local \gls{SDS}}]
deviceShare :: MTaskDevice -> Shared MTaskDevice
deviceShare d = mapReadWriteError
- ( \ds->case find ((==)d) of
+ ( \ds->case find ((==)d) ds of
Nothing = exception "Device lost"
Just d = Ok d)
, \w ds->case splitWith ((==)d) ds of