Skip to content

Commit

Permalink
ouroboros-network-framework: added Functor instances
Browse files Browse the repository at this point in the history
* `ConnectionId`
* `MinimalInitiatorContext`
* `ResponderContext`
  • Loading branch information
coot committed Jun 2, 2023
1 parent 06c704b commit 582648a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ouroboros-network-framework/CHANGELOG.md
Expand Up @@ -57,6 +57,10 @@
`Ouroboros.Network.Channel.fromChannel`). `runMuxPeer` accepts the context (added argument) and
`Ouroboros.Network.Channel.Channel`.

### Non-breaking changes

* Added `Functor` instance for `ConnectionId`.

## 0.6.0.1 -- 2023-05-15

* Updated to use `ouroboros-network-api-0.5.0.0`.
Expand Down
@@ -1,3 +1,4 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
Expand Down Expand Up @@ -26,6 +27,7 @@ data ConnectionId addr = ConnectionId {
}
deriving (Eq, Ord, Show, Generic)
deriving NoThunks via InspectHeap (ConnectionId addr)
deriving Functor

instance Hashable a => Hashable (ConnectionId a)

Expand Down
4 changes: 4 additions & 0 deletions ouroboros-network-framework/src/Ouroboros/Network/Context.hs
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveFunctor #-}

-- | Initiator and responder execution context.
--
module Ouroboros.Network.Context
Expand Down Expand Up @@ -30,9 +32,11 @@ data ExpandedInitiatorContext addr m = ExpandedInitiatorContext {
newtype MinimalInitiatorContext addr = MinimalInitiatorContext {
micConnectionId :: ConnectionId addr
}
deriving Functor

-- | Context passed to each responder mini-protocol execution.
--
newtype ResponderContext addr = ResponderContext {
rcConnectionId :: ConnectionId addr
}
deriving Functor

0 comments on commit 582648a

Please sign in to comment.