1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Develop.Socket (watchFile) where
5import Control.Concurrent (forkIO, threadDelay)
6import Control.Exception (SomeException, catch)
7import qualified Data.ByteString.Char8 as BS
8import qualified Network.WebSockets as WS
9import qualified System.FSNotify.Devel as Notify
10import qualified System.FSNotify as Notify
14watchFile :: FilePath -> WS.PendingConnection -> IO ()
15watchFile watchedFile pendingConnection =
16 do connection <- WS.acceptRequest pendingConnection
18 Notify.withManager $ \mgmt ->
19 do stop <- Notify.treeExtAny mgmt "." ".elm" print
24tend :: WS.Connection -> IO ()
27 pinger :: Integer -> IO a
29 do threadDelay (5 * 1000 * 1000)
30 WS.sendPing connection (BS.pack (show n))
35 do _ <- WS.receiveDataMessage connection
38 shutdown :: SomeException -> IO ()
42 do _pid <- forkIO (receiver `catch` shutdown)
43 pinger 1 `catch` shutdown
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list