+ writet :: [String] -> (*TTY -> *TTY)
+ writet [] = id
+ writet [x:xs] = writet xs o TTYwrite x
+
+
+syncNetworkChannel :: String Int (Shared ([MTaskMSGRecv], [MTaskMSGSend], Bool)) -> Task ()
+syncNetworkChannel server port channel
+ = tcpconnect server port channel {ConnectionHandlers|onConnect=onConnect,whileConnected=whileConnected,onDisconnect=onDisconnect} @! ()
+ where
+ onConnect :: String ([MTaskMSGRecv],[MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool)
+ onConnect _ (msgs,send,sendStopped)
+ = (Ok "", Just (msgs,[],sendStopped), map encode send, False)
+
+ whileConnected :: (Maybe String) String ([MTaskMSGRecv], [MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool)
+ whileConnected Nothing acc (msgs,send,sendStopped)
+ = (Ok acc, Nothing, [], False)
+// = (Ok acc, Just (msgs,[],sendStopped), map encode send, False)