summaryrefslogtreecommitdiff
path: root/Que/Server.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-15 15:24:32 -0700
committerBen Sima <ben@bsima.me>2020-04-15 17:19:43 -0700
commite9a53b69ad68e531a789eff3128f7304fd411808 (patch)
tree7c0382cb3c49458e8c989eaaa042bc37b37a9699 /Que/Server.hs
parentcb77d0eb623c7a398ca86a632d0ea37ac385cc3d (diff)
Lint fixes, also delete Biz.Language
Diffstat (limited to 'Que/Server.hs')
-rw-r--r--Que/Server.hs12
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 ()