diff options
-rw-r--r-- | debug-me.hs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/debug-me.hs b/debug-me.hs index a5115cd..c219360 100644 --- a/debug-me.hs +++ b/debug-me.hs @@ -15,7 +15,6 @@ import System.Exit import qualified Data.ByteString as B import Data.List.NonEmpty (NonEmpty(..), toList) import Data.Monoid -import Debug.Trace main :: IO () main = do @@ -28,7 +27,7 @@ main = do ichan <- newTChanIO ochan <- newTChanIO dthread <- async (developer ichan ochan) - uthread <- async (user p ichan ochan ph) + uthread <- async (user p ichan ochan) exitstatus <- waitForProcess ph cancel dthread cancel uthread @@ -108,12 +107,12 @@ sendTtyOutput ochan devstate = go -- missed one somehow. Ignore it? _ -> return mempty -user :: Pty -> TChan (Activity Entered) -> TChan (Activity Seen) -> ProcessHandle -> IO () -user p ichan ochan ph = do +user :: Pty -> TChan (Activity Entered) -> TChan (Activity Seen) -> IO () +user p ichan ochan = do let startact = StartActivity (Seen ">>> debug-me started\r\n") dummySignature atomically $ writeTChan ochan startact backlog <- newTVarIO $ Backlog ((hash startact, startact) :| []) - _ <- sendPtyOutput p ochan backlog ph + _ <- sendPtyOutput p ochan backlog `concurrently` sendPtyInput ichan p backlog return () @@ -122,8 +121,8 @@ data Backlog = Backlog (NonEmpty (HashPointer, Activity Seen)) deriving (Show) -- | Forward things written to the Pty out the TChan. -sendPtyOutput :: Pty -> TChan (Activity Seen) -> TVar Backlog -> ProcessHandle -> IO () -sendPtyOutput p ochan backlog ph = go +sendPtyOutput :: Pty -> TChan (Activity Seen) -> TVar Backlog -> IO () +sendPtyOutput p ochan backlog = go where go = do b <- readPty p @@ -153,12 +152,12 @@ sendPtyInput ichan p backlog = go writeTVar backlog bl' return (Right (enteredData (activityContent newact))) else do - return (Left ("illegal entry", newact, bl')) + return (Left ("illegal entry" :: String, newact, bl')) case mb of Right b -> do writePty p b go - Left e -> do + Left _e -> do -- print e go |