{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -Wno-orphans #-} module Cardano.Node.Orphans () where import Cardano.Prelude import qualified Prelude import Data.Aeson (FromJSON (..), Value (..)) import qualified Data.Text as Text import Cardano.BM.Data.Tracer (TracingVerbosity (..)) import qualified Cardano.Chain.Update as Update instance FromJSON TracingVerbosity where parseJSON :: Value -> Parser TracingVerbosity parseJSON (String Text str) = case Text str of Text "MinimalVerbosity" -> TracingVerbosity -> Parser TracingVerbosity forall (f :: * -> *) a. Applicative f => a -> f a pure TracingVerbosity MinimalVerbosity Text "MaximalVerbosity" -> TracingVerbosity -> Parser TracingVerbosity forall (f :: * -> *) a. Applicative f => a -> f a pure TracingVerbosity MaximalVerbosity Text "NormalVerbosity" -> TracingVerbosity -> Parser TracingVerbosity forall (f :: * -> *) a. Applicative f => a -> f a pure TracingVerbosity NormalVerbosity Text err -> Text -> Parser TracingVerbosity forall a. HasCallStack => Text -> a panic (Text -> Parser TracingVerbosity) -> Text -> Parser TracingVerbosity forall a b. (a -> b) -> a -> b $ Text "Parsing of TracingVerbosity failed, " Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> Text err Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> Text " is not a valid TracingVerbosity" parseJSON Value invalid = Text -> Parser TracingVerbosity forall a. HasCallStack => Text -> a panic (Text -> Parser TracingVerbosity) -> Text -> Parser TracingVerbosity forall a b. (a -> b) -> a -> b $ Text "Parsing of TracingVerbosity failed due to type mismatch. " Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> Text "Encountered: " Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> String -> Text Text.pack (Value -> String forall a. Show a => a -> String Prelude.show Value invalid) deriving instance Show TracingVerbosity instance FromJSON Update.ApplicationName where parseJSON :: Value -> Parser ApplicationName parseJSON (String Text x) = ApplicationName -> Parser ApplicationName forall (f :: * -> *) a. Applicative f => a -> f a pure (ApplicationName -> Parser ApplicationName) -> ApplicationName -> Parser ApplicationName forall a b. (a -> b) -> a -> b $ Text -> ApplicationName Update.ApplicationName Text x parseJSON Value invalid = Text -> Parser ApplicationName forall a. HasCallStack => Text -> a panic (Text -> Parser ApplicationName) -> Text -> Parser ApplicationName forall a b. (a -> b) -> a -> b $ Text "Parsing of application name failed due to type mismatch. " Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> Text "Encountered: " Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> String -> Text Text.pack (Value -> String forall a. Show a => a -> String Prelude.show Value invalid)