Shorten two lines of code to one

This commit is contained in:
1computer1 2019-07-09 05:25:19 -04:00
parent 93a4378475
commit edab8835ad

View file

@ -45,8 +45,7 @@ serverT = handleLanguages :<|> handleEval
handleEval :: EvalRequest -> MyriadT m EvalResponse handleEval :: EvalRequest -> MyriadT m EvalResponse
handleEval EvalRequest { language, code } = do handleEval EvalRequest { language, code } = do
logInfoN $ mconcat ["POST /eval"] logInfoN $ mconcat ["POST /eval"]
env <- ask MyriadConfig { languages } <- asks config
let MyriadConfig { languages } = config env
case find (\x -> name x == language) languages of case find (\x -> name x == language) languages of
Nothing -> throwError $ err404 { errBody = "Language " <> cvs language <> " was not found" } Nothing -> throwError $ err404 { errBody = "Language " <> cvs language <> " was not found" }
Just cfg -> do Just cfg -> do