summaryrefslogtreecommitdiff
path: root/lib/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Types.hs')
-rw-r--r--lib/Types.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Types.hs b/lib/Types.hs
index fd2bd20..c39297f 100644
--- a/lib/Types.hs
+++ b/lib/Types.hs
@@ -26,7 +26,7 @@ import WithCli.Pure (Argument (argumentType, parseArgumen
-- | Levels of errors and warnings, collectively called
-- "Hints" until I can think of some better name
data Level = Info | Suggestion | Warning | Forbidden | Error | Fatal
- deriving (Show, Generic, ToJSON, Ord, Eq, A.FromJSON)
+ deriving (Show, Generic, Ord, Eq, ToJSON)
instance Argument Level where
argumentType Proxy = "Lint Level"
@@ -54,7 +54,7 @@ data Dep = Local RelPath | Link Text | MapLink Text | LocalMap RelPath
data Hint = Hint
{ hintLevel :: Level
, hintMsg :: Text
- } deriving (Generic, ToJSON)
+ } deriving (Generic)
-- | shorter constructor (called hint because (a) older name and
-- (b) lint also exists and is monadic)
@@ -75,13 +75,14 @@ instance PrettyPrint Lint where
" Info: map offers entrypoint " <> prettyprint dep
instance ToJSON Lint where
- toJSON (Lint l) = toJSON l
+ toJSON (Lint (Hint l m)) = A.object
+ [ "msg" .= m, "level" .= l ]
toJSON (Depends dep) = A.object
- [ "hintMsg" .= prettyprint dep
- , "hintLevel" .= A.String "Dependency Info" ]
+ [ "msg" .= prettyprint dep
+ , "level" .= A.String "Dependency Info" ]
toJSON (Offers l) = A.object
- [ "hintMsg" .= prettyprint l
- , "hintLevel" .= A.String "Entrypoint Info" ]
+ [ "msg" .= prettyprint l
+ , "level" .= A.String "Entrypoint Info" ]
instance ToJSON Dep where
toJSON = \case