Skip to content

Commit

Permalink
pimp show instance for SimpleContext to match json representation
Browse files Browse the repository at this point in the history
  • Loading branch information
jberthold committed Jun 20, 2024
1 parent a510b1a commit bcef5c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kore-rpc-types/src/Kore/JsonRpc/Types/ContextLog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ module Kore.JsonRpc.Types.ContextLog (
) where

import Data.Aeson.TH (deriveJSON)
import Data.Aeson.Types (FromJSON (..), Options (..), ToJSON (..), defaultOptions)
import Data.Aeson.Types (FromJSON (..), ToJSON (..), defaultOptions)
import Data.Aeson.Types qualified as JSON
import Data.Char (toLower)
import Data.Data (Data, toConstr)
import Data.Sequence (Seq)
import Data.Text (Text, unpack)
import Data.Text qualified as Text
Expand Down Expand Up @@ -51,7 +52,10 @@ data SimpleContext
CtxError
| CtxWarn
| CtxInfo
deriving stock (Show, Eq, Ord, Enum)
deriving stock (Eq, Ord, Enum, Data)

instance Show SimpleContext where
show = JSON.camelTo2 '-' . drop 3 . show . toConstr

$( deriveJSON
defaultOptions
Expand Down Expand Up @@ -127,7 +131,7 @@ data CLContext
deriving stock (Eq)

instance Show CLContext where
show (CLNullary c) = map toLower . drop 3 $ show c
show (CLNullary c) = show c
show (CLWithId withId) = show withId

instance ToJSON CLContext where
Expand Down

0 comments on commit bcef5c3

Please sign in to comment.