blob: 6ed1a6bfc0c7b05b46a332ede6600b2e0ab239f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
module Role.Watcher where
import Types
import Log
import Pty
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 :: TMChan (Message Entered) -> TMChan (Message Seen) -> SessionID -> IO ()
watcher _ichan ochan _ = inRawMode $ do
st <- processSessionStart ochan nullLogger
go st
where
go st = do
v <- atomically $ getUserMessage ochan st
case v of
Nothing -> return ()
Just (o, _msg) -> do
emitOutput o
go st
|