summaryrefslogtreecommitdiff
path: root/lib/LintWriter.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/LintWriter.hs26
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/LintWriter.hs b/lib/LintWriter.hs
index 2b891c3..d0c6c4e 100644
--- a/lib/LintWriter.hs
+++ b/lib/LintWriter.hs
@@ -42,21 +42,15 @@ module LintWriter
, adjust
) where
-import Data.Text (Text)
-
-import Badges (Badge)
-import Control.Monad.State (MonadState (put), StateT, modify)
-import Control.Monad.Trans.Reader (Reader, asks, runReader)
-import Control.Monad.Trans.State (get, runStateT)
-import Control.Monad.Writer.Lazy (lift)
-import Data.Bifunctor (Bifunctor (second))
-import Data.Map (Map, fromListWith)
-import Data.Maybe (mapMaybe)
-import qualified Data.Set as S
-import LintConfig (LintConfig')
-import TiledAbstract (HasName (getName))
-import Types (Dep, Hint, Level (..), Lint (..),
- hint, lintsToHints)
+import Universum
+
+
+import Badges (Badge)
+import Data.Map (fromListWith)
+import LintConfig (LintConfig')
+import TiledAbstract (HasName (getName))
+import Types (Dep, Hint, Level (..), Lint (..), hint,
+ lintsToHints)
-- | A monad modelling the main linter features
@@ -109,7 +103,7 @@ zoom embed extract operation = do
-- | "invert" a linter's result, grouping lints by their messages
invertLintResult :: HasName ctxt => LintResult ctxt -> Map Hint [Text]
invertLintResult (LinterState (lints, ctxt)) =
- fmap (S.toList . S.fromList . fmap getName) . fromListWith (<>) $ (, [ctxt]) <$> lintsToHints lints
+ fmap (sortNub . map getName) . fromListWith (<>) $ (, [ctxt]) <$> lintsToHints lints
resultToDeps :: LintResult a -> [Dep]
resultToDeps (LinterState (lints,_)) = mapMaybe lintToDep lints