Skip to content

Commit

Permalink
duplicate instances
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 committed Feb 6, 2024
1 parent fbd711f commit d99a5b5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
1 change: 0 additions & 1 deletion .github/workflows/check-mainnet-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ jobs:
exit 1
fi
done
15 changes: 0 additions & 15 deletions cardano-node/src/Cardano/Node/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,12 @@ module Cardano.Node.Orphans () where
import Cardano.Api ()

import Data.Aeson.Types
import qualified Data.Text as Text

import Cardano.BM.Data.Tracer (TracingVerbosity (..))
import Ouroboros.Network.NodeToNode (AcceptedConnectionsLimit (..))
import Ouroboros.Network.SizeInBytes (SizeInBytes (..))

import Text.Printf (PrintfArg (..))


instance FromJSON TracingVerbosity where
parseJSON (String str) = case str of
"MinimalVerbosity" -> pure MinimalVerbosity
"MaximalVerbosity" -> pure MaximalVerbosity
"NormalVerbosity" -> pure NormalVerbosity
err -> fail $ "Parsing of TracingVerbosity failed, "
<> Text.unpack err <> " is not a valid TracingVerbosity"
parseJSON invalid = fail $ "Parsing of TracingVerbosity failed due to type mismatch. "
<> "Encountered: " <> show invalid

deriving instance Show TracingVerbosity

instance PrintfArg SizeInBytes where
formatArg (SizeInBytes s) = formatArg s

Expand Down
13 changes: 0 additions & 13 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module Cardano.Tracing.OrphanInstances.Common
import Data.Aeson hiding (Value)
import Data.Scientific (coefficient)
import Data.Text (Text)
import qualified Data.Text as Text
import Data.Void (Void)
import Network.Socket (PortNumber)
import Text.Read (readMaybe)
Expand All @@ -62,18 +61,6 @@ import Cardano.Node.Handlers.Shutdown ()
instance ToObject Void where
toObject _verb x = case x of {}

deriving instance Show TracingVerbosity

instance FromJSON TracingVerbosity where
parseJSON (String str) = case str of
"MinimalVerbosity" -> pure MinimalVerbosity
"MaximalVerbosity" -> pure MaximalVerbosity
"NormalVerbosity" -> pure NormalVerbosity
invalid -> fail $ "Parsing of TracingVerbosity failed, "
<> Text.unpack invalid <> " is not a valid TracingVerbosity"
parseJSON invalid = fail $ "Parsing of TracingVerbosity failed due to type mismatch. "
<> "Encountered: " <> show invalid

instance FromJSON PortNumber where
parseJSON (Number portNum) = case readMaybe . show $ coefficient portNum of
Just port -> pure port
Expand Down

0 comments on commit d99a5b5

Please sign in to comment.