- whileConnected maybeNewData acc (msgs,send,sendStopped)
- # l = map decode (maybeToList maybeNewData)
- # send = if (not sendStopped) [] (map encode send)
- = (Ok acc, Just (msgs ++ l,[],sendStopped), send, False)
+ whileConnected Nothing acc (msgs,send,sendStopped)
+ = (Ok acc, Nothing, [], False)
+// = (Ok acc, Just (msgs,[],sendStopped), map encode send, False)
+
+ whileConnected (Just newData) acc (msgs,send,sendStopped)
+ | sendStopped = (Ok acc, Just (msgs ++ [decode newData],[],False), map encode send, False)
+ = (Ok acc, Just (msgs ++ [decode newData],[],False), [], False)