summaryrefslogtreecommitdiffhomepage
path: root/Role/Watcher.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Role/Watcher.hs')
-rw-r--r--Role/Watcher.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Role/Watcher.hs b/Role/Watcher.hs
index 620733c..6ed1a6b 100644
--- a/Role/Watcher.hs
+++ b/Role/Watcher.hs
@@ -7,17 +7,21 @@ import CmdLine
import SessionID
import Control.Concurrent.STM
+import Control.Concurrent.STM.TMChan
import Role.Developer (run', processSessionStart, getUserMessage, emitOutput)
run :: WatchOpts -> IO ()
run = run' watcher . watchUrl
-watcher :: TChan (Message Entered) -> TChan (Message Seen) -> SessionID -> IO ()
+watcher :: TMChan (Message Entered) -> TMChan (Message Seen) -> SessionID -> IO ()
watcher _ichan ochan _ = inRawMode $ do
st <- processSessionStart ochan nullLogger
go st
where
go st = do
- (o, _msg) <- atomically $ getUserMessage ochan st
- emitOutput o
- go st
+ v <- atomically $ getUserMessage ochan st
+ case v of
+ Nothing -> return ()
+ Just (o, _msg) -> do
+ emitOutput o
+ go st