From c7c4f50f5b34d487080eb9293d91b8de4a37d8db Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 27 Jan 2021 22:22:12 +0100 Subject: [PATCH] refactor: hlint --- src/Application.hs | 2 +- src/Handler/Workflow/Workflow/List.hs | 4 +--- src/Utils.hs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index 38c23b6f0..708cfaf38 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -568,7 +568,7 @@ appMain = runResourceT $ do void . runMaybeT $ do results <- hoistMaybe mResults - let latestResults = Map.fromListWith (flip const) $ Set.toAscList results + let latestResults = Map.fromListWith (\_ x -> x) $ Set.toAscList results Min status <- hoistMaybe $ ofoldMap1 (Min . healthReportStatus) <$> fromNullable latestResults $logInfoS "NotifyStatus" $ toPathPiece status liftIO . void . Systemd.notifyStatus . unpack $ toPathPiece status diff --git a/src/Handler/Workflow/Workflow/List.hs b/src/Handler/Workflow/Workflow/List.hs index 8b7670340..c9333ccbb 100644 --- a/src/Handler/Workflow/Workflow/List.hs +++ b/src/Handler/Workflow/Workflow/List.hs @@ -388,9 +388,7 @@ workflowWorkflowList (title, heading) WWListColumns{..} sqlPred = do viewActors <- hoistMaybe $ preview _wgeViewActor =<< mVia guardM $ anyM (otoList viewActors) hasWorkflowRole' resUser <- lift . lift $ traverse getEntity wpUser' - return $ case resUser of - Just mEnt -> toJsonUser mEnt - Nothing -> JsonWorkflowUserAnonymous + return $ maybe JsonWorkflowUserAnonymous toJsonUser resUser payload <- do payload' <- fmap Map.fromList . forMaybeM (Map.toList currentPayload) $ \x@(payloadLbl, _) -> x <$ do diff --git a/src/Utils.hs b/src/Utils.hs index e08484afb..159e1d424 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -465,7 +465,7 @@ assertMonoid f x = guardMonoid (f x) x maybeMonoid :: Monoid m => Maybe m -> m -- ^ Identify `Nothing` with `mempty` -maybeMonoid = maybe mempty id +maybeMonoid = fromMaybe mempty ------------ -- Tuples --