diff options
Diffstat (limited to '')
-rw-r--r-- | lib/LintWriter.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/LintWriter.hs b/lib/LintWriter.hs index 8e45812..10c727d 100644 --- a/lib/LintWriter.hs +++ b/lib/LintWriter.hs @@ -10,9 +10,11 @@ import Control.Monad.Trans.Maybe () import Control.Monad.Writer (MonadTrans (lift), MonadWriter (tell), WriterT) import Data.Aeson (ToJSON (toJSON)) -import Data.Text (Text, unpack) +import Data.Text (Text) import GHC.Generics (Generic) +import Util (PrettyPrint(..), showText) + -- | Levels of errors and warnings, collectively called -- "Hints" until I can think of some better name data Level = Warning | Suggestion | Info | Forbidden | Error | Fatal @@ -24,9 +26,9 @@ data Hint = Hint , hintMsg :: Text } deriving (Generic, ToJSON) -instance Show Hint where - show Hint { hintMsg, hintLevel } = - show hintLevel <> ": " <> unpack hintMsg +instance PrettyPrint Hint where + prettyprint Hint { hintMsg, hintLevel } = + showText hintLevel <> ": " <> hintMsg -- shorter constructor hint :: Level -> Text -> Hint |