Skip to content

Commit

Permalink
Merge pull request #5083 from IntersectMBO/erikd/typeable
Browse files Browse the repository at this point in the history
Remove all derived Typeable instances
  • Loading branch information
erikd authored Feb 25, 2025
2 parents 7a14bad + 8ca6092 commit 1cb4a4a
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Control.Monad ((>=>))
import Data.Bits (clearBit, setBit, testBit)
import Data.Text (Text)
import Data.Text qualified as T
import Data.Typeable (Typeable)
import GHC.Generics
import Ouroboros.Network.CodecCBORTerm
import Ouroboros.Network.Handshake.Acceptable (Accept (..), Acceptable (..))
Expand Down Expand Up @@ -53,7 +52,7 @@ data NodeToClientVersion
-- ^ added @GetLedgerPeerSnapshot@
| NodeToClientV_20
-- ^ added @QueryStakePoolDefaultVote@
deriving (Eq, Ord, Enum, Bounded, Show, Typeable, Generic, NFData)
deriving (Eq, Ord, Enum, Bounded, Show, Generic, NFData)

-- | We set 16ths bit to distinguish `NodeToNodeVersion` and
-- `NodeToClientVersion`. This way connecting wrong protocol suite will fail
Expand Down Expand Up @@ -106,7 +105,7 @@ data NodeToClientVersionData = NodeToClientVersionData
{ networkMagic :: !NetworkMagic
, query :: !Bool
}
deriving (Eq, Show, Typeable)
deriving (Eq, Show)

instance Acceptable NodeToClientVersionData where
acceptableVersion local remote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module Ouroboros.Network.NodeToNode.Version

import Data.Text (Text)
import Data.Text qualified as T
import Data.Typeable (Typeable)

import Codec.CBOR.Term qualified as CBOR

Expand Down Expand Up @@ -69,7 +68,7 @@ data NodeToNodeVersion =
-- peer sharing server side and can not reply to requests.
| NodeToNodeV_14
-- ^ Chang+1 HF
deriving (Eq, Ord, Enum, Bounded, Show, Typeable, Generic, NFData)
deriving (Eq, Ord, Enum, Bounded, Show, Generic, NFData)

nodeToNodeVersionCodec :: CodecCBORTerm (Text, Maybe Int) NodeToNodeVersion
nodeToNodeVersionCodec = CodecCBORTerm { encodeTerm, decodeTerm }
Expand Down Expand Up @@ -105,7 +104,7 @@ nodeToNodeVersionCodec = CodecCBORTerm { encodeTerm, decodeTerm }
data DiffusionMode
= InitiatorOnlyDiffusionMode
| InitiatorAndResponderDiffusionMode
deriving (Typeable, Eq, Ord, Show)
deriving (Eq, Ord, Show)


-- | Version data for NodeToNode protocol
Expand All @@ -116,7 +115,7 @@ data NodeToNodeVersionData = NodeToNodeVersionData
, peerSharing :: !PeerSharing
, query :: !Bool
}
deriving (Show, Typeable, Eq)
deriving (Show, Eq)
-- 'Eq' instance is not provided, it is not what we need in version
-- negotiation (see 'Acceptable' instance below).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ data ExperimentError =
| SimulationTimeout

deriving instance Show ExperimentError
deriving instance Typeable ExperimentError
instance Exception ExperimentError where

-- | Run a central server that talks to any number of clients and other nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ data PromiseWriter m a = PromiseWriter {
}

data PromiseWriterException = PromiseWriterBlocked
deriving (Show, Typeable)
deriving (Show)

instance Exception PromiseWriterException

Expand Down Expand Up @@ -399,7 +399,6 @@ data ExceptionInHandler where
=> !peerAddr
-> !SomeException
-> ExceptionInHandler
deriving Typeable

instance Show ExceptionInHandler where
show (ExceptionInHandler peerAddr e) = "ExceptionInHandler "
Expand Down Expand Up @@ -684,7 +683,7 @@ data AbstractState =
| WaitRemoteIdleSt
| TerminatingSt
| TerminatedSt
deriving (Eq, Ord, Show, Typeable)
deriving (Eq, Ord, Show)


-- | Counters for tracing and analysis purposes
Expand Down Expand Up @@ -742,7 +741,7 @@ data ConnectionManagerError peerAddr
-- was expected.
--
| UnknownPeer !peerAddr !CallStack
deriving (Show, Typeable)
deriving (Show)


instance ( Show peerAddr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Control.Monad.Class.MonadTime.SI
import Control.Monad.Class.MonadTimer.SI
import Control.Tracer (Tracer, traceWith)

import Data.Typeable (Typeable)
import Data.Word
import Text.Printf

Expand Down Expand Up @@ -144,7 +143,7 @@ data AcceptConnectionsPolicyTrace
= ServerTraceAcceptConnectionRateLimiting DiffTime Int
| ServerTraceAcceptConnectionHardLimit Word32
| ServerTraceAcceptConnectionResume Int
deriving (Eq, Ord, Typeable)
deriving (Eq, Ord)

instance Show AcceptConnectionsPolicyTrace where
show (ServerTraceAcceptConnectionRateLimiting delay numberOfConnections) =
Expand Down
3 changes: 1 addition & 2 deletions ouroboros-network-framework/src/Ouroboros/Network/Snocket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import Control.Exception
import Data.Bifoldable (Bifoldable (..))
import Data.Bifunctor (Bifunctor (..))
import Data.Hashable
import Data.Typeable (Typeable)
import Data.Word
import GHC.Generics (Generic)
import Quiet (Quiet (..))
Expand Down Expand Up @@ -202,7 +201,7 @@ instance Hashable LocalAddress where
hashWithSalt s (LocalAddress path) = hashWithSalt s path

newtype TestAddress addr = TestAddress { getTestAddress :: addr }
deriving (Eq, Ord, Typeable, Generic, NFData)
deriving (Eq, Ord, Generic, NFData)
deriving NoThunks via InspectHeap (TestAddress addr)
deriving Show via Quiet (TestAddress addr)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ data ResourceException
(Maybe SomeException)

deriving instance Show ResourceException
deriving instance Typeable ResourceException
instance Exception ResourceException where


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import Data.IP qualified as IP
import Data.Map.Strict (Map)
import Data.Map.Strict qualified as Map
import Data.Monoid.Synchronisation
import Data.Typeable (Typeable)
import Data.Void (Void)
import GHC.Generics (Generic)
import Numeric.Natural (Natural)
Expand Down Expand Up @@ -359,7 +358,7 @@ withSlotTime slotDuration k = do
-- | Node kernel erros.
--
data NodeKernelError = UnexpectedSlot !SlotNo !SlotNo
deriving (Typeable, Show)
deriving Show

instance Exception NodeKernelError where

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ mockPeerSelectionActions tracer
data TransitionError
= ActivationError
| DeactivationError
deriving (Show, Typeable)
deriving Show

instance Exception TransitionError where

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ mockResolveLedgerPeers tracer (MockRoots _ _ publicRootPeers dnsMapScript)
data TestTraceEvent = RootPeerDNSLocal (TraceLocalRootPeers () SockAddr Failure)
| LocalRootPeersResults [(HotValency, WarmValency, Map SockAddr (LocalRootConfig ()))]
| RootPeerDNSPublic TracePublicRootPeers
deriving (Show, Typeable)
deriving Show

tracerTraceLocalRoots :: Tracer (IOSim s) (TraceLocalRootPeers () SockAddr Failure)
tracerTraceLocalRoots = contramap RootPeerDNSLocal tracerTestTraceEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Data.Map.Strict (Map)
import Data.Map.Strict qualified as Map
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Typeable (Typeable)
import Ouroboros.Network.PeerSelection.PeerAdvertise (PeerAdvertise (..))
import Ouroboros.Network.PeerSelection.Types

Expand All @@ -15,7 +14,7 @@ data ExtraPeers peeraddr =
{ getPublicConfigPeers :: !(Map peeraddr PeerAdvertise)
, getBootstrapPeers :: !(Set peeraddr)
}
deriving (Eq, Show, Typeable)
deriving (Eq, Show)

instance Ord peeraddr => Semigroup (ExtraPeers peeraddr) where
(ExtraPeers a b) <> (ExtraPeers a' b') =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ data MiniProtocolException = MiniProtocolException {
deriving Show

newtype MiniProtocolExceptions = MiniProtocolExceptions [MiniProtocolException]
deriving (Show, Typeable)
deriving Show

instance Exception MiniProtocolExceptions

Expand Down

0 comments on commit 1cb4a4a

Please sign in to comment.