diff options
author | stuebinm | 2021-12-02 02:28:23 +0100 |
---|---|---|
committer | stuebinm | 2021-12-02 16:00:54 +0100 |
commit | 7d8c66b4c3ffd610ef0da98c3f2ff8626f1c8af6 (patch) | |
tree | 1fd37b223dea6001c421aa17471d5108d2eb4e0a /lib/LintWriter.hs | |
parent | c2a49d6ea46c38f107ac1a47a965e4777be2aecc (diff) |
collect badges from object layers
this includes a halfway-reasonable parsing of object layers, as well as
some monad plumbing to get them all in the right place.
Diffstat (limited to 'lib/LintWriter.hs')
-rw-r--r-- | lib/LintWriter.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/LintWriter.hs b/lib/LintWriter.hs index c8ab6d5..e235fca 100644 --- a/lib/LintWriter.hs +++ b/lib/LintWriter.hs @@ -24,6 +24,7 @@ import Data.Maybe (mapMaybe) import qualified Data.Text as T import Util (PrettyPrint (..)) +import Badges (Badge) import LintConfig (LintConfig') import Tiled2 (HasName) import Types @@ -87,6 +88,11 @@ resultToOffers (LintResult a) = mapMaybe lintToOffer $ snd a resultToLints :: LintResult a -> [Lint] resultToLints (LintResult res) = snd res +resultToBadges :: LintResult a -> [Badge] +resultToBadges (LintResult a) = mapMaybe lintToBadge $ snd a + where lintToBadge (Badge badge) = Just badge + lintToBadge _ = Nothing + resultToAdjusted :: LintResult a -> a resultToAdjusted (LintResult res) = fst res @@ -110,6 +116,9 @@ dependsOn dep = tell' $ Depends dep offersEntrypoint :: Text -> LintWriter a offersEntrypoint text = tell' $ Offers text +offersBadge :: Badge -> LintWriter a +offersBadge badge = tell' $ Badge badge + -- | adjusts the context. Gets a copy of the /current/ context, i.e. one which might -- have already been changed by other lints adjust :: (a -> a) -> LintWriter a |