-sendTaskToDevice :: String (Main (ByteCode a Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
-sendTaskToDevice wta mTask (device, timeout) =
- get bcStateStore @ toMessages timeout mTask
- >>= \(msgs, st1)->set st1 bcStateStore
- >>| toSDSRecords msgs st1 device
- >>= \sdss->upd (mergeShares sdss) sdsStore
+import StdDebug
+import StdMisc
+sendTaskToDevice :: String (Main (ByteCode a Stmt)) (MTaskDevice, MTaskInterval) -> Task [MTaskDevice]
+sendTaskToDevice wta mTask (device, timeout)
+| not (trace_tn "compiling task") = undef
+# (msgs, newState=:{sdss}) = toMessages timeout mTask device.deviceState
+| not (trace_tn "Done compiling task") = undef
+# shares = [makeShare wta "" sdsi sdsval\\{sdsi,sdsval}<-sdss, (MTSds sdsi` _)<-msgs | sdsi == sdsi`]
+= updateShares device ((++) shares)