diff options
Diffstat (limited to 'Que/Server.hs')
-rw-r--r-- | Que/Server.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Que/Server.hs b/Que/Server.hs index b0f3fbd..9e8d893 100644 --- a/Que/Server.hs +++ b/Que/Server.hs @@ -84,7 +84,7 @@ newtype App a (STM.TVar AppState) ) -data AppState +newtype AppState = AppState { ques :: HashMap Namespace Quebase } @@ -92,7 +92,7 @@ data AppState initialAppState :: AppState initialAppState = AppState {ques = mempty} -data Config +newtype Config = Config { -- | QUE_PORT quePort :: Warp.Port @@ -139,9 +139,9 @@ routes = do q <- app <| que ns qp poll <- Scotty.param "poll" !: (pure . const False) guardNs ns ["pub", "_"] - case poll of - True -> Scotty.stream $ streamQue q - _ -> do + if poll + then Scotty.stream $ streamQue q + else do r <- liftIO <| Go.read q Scotty.html <| fromStrict <| Encoding.decodeUtf8 r -- POST que @@ -225,7 +225,7 @@ app = lift -- | Get something from the app state gets :: (AppState -> b) -> App b -gets f = ask >>= liftIO . STM.readTVarIO >>= return . f +gets f = ask >>= liftIO . STM.readTVarIO >>= return </ f -- | Apply a function to the app state modify :: (AppState -> AppState) -> App () |