on master help sign in
fix hlint suggestions
commit0de18651a81ee2ef83ec51cbea21b98bb40a3fd8 authorAgentM <agentm@themactionfaction.com> dateMon 13 Nov 2017, 21:10 (9 years ago) parent874b1ad
1 file changed+7−16
src/bin/ProjectM36/Server/WebSocket.hs+7−16
src/bin/ProjectM36/Server/WebSocket.hs+7−16
@@ -50,7 +50,7 @@ websocketProxyServer port host pending = do
5050 msg <- WS.receiveData conn :: IO T.Text
5151 case parseOnly parseExecuteMessage msg of
5252 Left _ -> unexpectedMsg
53− Right (presentation, tutdString) -> do
53+ Right (presentation, tutdString) ->
5454 case parseTutorialD tutdString of
5555 Left err -> handleOpResult conn dbconn presentation (DisplayErrorResult ("parse error: " `T.append` T.pack (parseErrorPretty err)))
5656 Right parsed -> do
@@ -82,25 +82,16 @@ handleOpResult conn db _ QuitResult = WS.sendClose conn ("close" :: T.Text) >> c
8282handleOpResult conn _ _ (DisplayResult out) = WS.sendTextData conn (encode (object ["display" .= out]))
8383handleOpResult _ _ _ (DisplayIOResult ioout) = ioout
8484handleOpResult conn _ presentation (DisplayErrorResult err) = do
85− let jsono = if jsonPresentation presentation then
86− ["json" .= err] else []
87− texto = if textPresentation presentation then
88− ["text" .= err] else []
89− htmlo = if textPresentation presentation then
90− ["html" .= err] else []
85+ let jsono = ["json" .= err | jsonPresentation presentation]
86+ texto = ["text" .= err | textPresentation presentation]
87+ htmlo = ["html" .= err | htmlPresentation presentation]
9188 WS.sendTextData conn (encode (object ["displayerror" .= object (jsono ++ texto ++ htmlo)]))
9289handleOpResult conn _ _ (DisplayParseErrorResult _ err) = WS.sendTextData conn (encode (object ["displayparseerrorresult" .= show err]))
9390handleOpResult conn _ _ QuietSuccessResult = WS.sendTextData conn (encode (object ["acknowledged" .= True]))
9491handleOpResult conn _ presentation (DisplayRelationResult rel) = do
95− let jsono = if jsonPresentation presentation then
96− ["json" .= rel]
97− else []
98− texto = if textPresentation presentation then
99− ["text" .= showRelation rel]
100− else []
101− htmlo = if htmlPresentation presentation then
102− ["html" .= relationAsHTML rel]
103− else []
92+ let jsono = ["json" .= rel | jsonPresentation presentation]
93+ texto = ["text" .= showRelation rel | textPresentation presentation]
94+ htmlo = ["html" .= relationAsHTML rel | htmlPresentation presentation]
10495 WS.sendTextData conn (encode (object ["displayrelation" .= object (jsono ++ texto ++ htmlo)]))
10596-- get current schema and head name for client
10697promptInfo :: SessionId -> Connection -> IO (HeadName, SchemaName)