Skip to content

Commit

Permalink
[aura] Improve scold signature
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Apr 23, 2020
1 parent 9061dd0 commit fa5549c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aura/exec/aura.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ execute env p = first f <$> try (runRIO env . execOpts $ _operation p)
f (Failure fl) = fl $ langOf (settings env)

exit :: Settings -> Either (Doc AnsiStyle) () -> IO a
exit ss (Left e) = scold ss e *> exitFailure
exit ss (Left e) = scold ss (const e) *> exitFailure
exit _ (Right _) = exitSuccess

execOpts :: Either (PacmanOp, Set MiscOp) AuraOp -> RIO Env ()
Expand Down
2 changes: 1 addition & 1 deletion aura/lib/Aura/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ overwritePkgbuild ss p = when (switch ss HotEdit || switch ss UseCustomizepkg) $
buildFail :: Failure -> RIO Env (Maybe a)
buildFail (Failure err) = do
ss <- asks settings
liftIO . scold ss . err $ langOf ss
scold ss err
withOkay ss buildFail_6 buildFail_5 $ pure Nothing

-- | Moves a file to the pacman package cache and returns its location.
Expand Down
4 changes: 2 additions & 2 deletions aura/lib/Aura/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ warn :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m ()
warn ss msg = putStrLnA ss $ yellow (msg $ langOf ss)

-- | Print some message in red with Aura flair.
scold :: Settings -> Doc AnsiStyle -> IO ()
scold ss = putStrLnA ss . red
scold :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m ()
scold ss msg = putStrLnA ss $ red (msg $ langOf ss)

-- | Report a message with multiple associated items. Usually a list of
-- naughty packages.
Expand Down
2 changes: 1 addition & 1 deletion aura/lib/Aura/Install.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ analysePkgbuild b = do
Just l -> case bannedTerms l of
[] -> pure ()
bts -> do
liftIO $ scold ss (security_5 (bName b) $ langOf ss)
scold ss . security_5 $ bName b
liftIO $ traverse_ (displayBannedTerms ss) bts
f

Expand Down

0 comments on commit fa5549c

Please sign in to comment.