smaller changes not changing semantics

This commit is contained in:
Dennis Frieberg 2022-01-02 23:58:22 +01:00
parent 70ee16d202
commit 1816bd9bb5
2 changed files with 8 additions and 11 deletions

View file

@ -41,6 +41,13 @@ defaultLogLevel = Info
blockBackends :: [MVar ()] -> EnvM ()
blockBackends = mapM_ takeMVar
runBackend :: Wai.Application -> Either (Maybe String) Bool -> Backend -> EnvM [MVar ()]
runBackend app (Left (Just conf)) (BackendWithConfig b _ _) = b app conf
runBackend _ (Left Nothing) (BackendWithConfig _ _ _) = return []
runBackend app (Right True) (BackendWithoutConfig b _ _) = b app
runBackend _ (Right False) (BackendWithoutConfig _ _ _) = return []
runBackend _ _ _ = logError "Backend and parser type don't match! THIS IS A BUG" >> return []
data CommandLineOptions = CommandLineOptions {
backendOptions :: [Either (Maybe String) Bool],
logSeverity :: Maybe Severity
@ -57,14 +64,6 @@ parser = CommandLineOptions
<$> backendsParser
<*> severityParser
runBackend :: Wai.Application -> Either (Maybe String) Bool -> Backend -> EnvM [MVar ()]
runBackend app (Left (Just conf)) (BackendWithConfig b _ _) = b app conf
runBackend _ (Left Nothing) (BackendWithConfig _ _ _) = return []
runBackend app (Right True) (BackendWithoutConfig b _ _) = b app
runBackend _ (Right False) (BackendWithoutConfig _ _ _) = return []
runBackend _ _ _ = logError "Backend and parser type don't match! THIS IS A BUG" >> return []
commandLineParser :: ParserInfo CommandLineOptions
commandLineParser = info (parser <**> helper)
( fullDesc