diff options
Diffstat (limited to 'src/Network/BitTorrent/Core/NodeInfo.hs')
-rw-r--r-- | src/Network/BitTorrent/Core/NodeInfo.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Core/NodeInfo.hs b/src/Network/BitTorrent/Core/NodeInfo.hs index 2fd7e575..fa20caf5 100644 --- a/src/Network/BitTorrent/Core/NodeInfo.hs +++ b/src/Network/BitTorrent/Core/NodeInfo.hs | |||
@@ -19,6 +19,7 @@ | |||
19 | {-# LANGUAGE TemplateHaskell #-} | 19 | {-# LANGUAGE TemplateHaskell #-} |
20 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | 20 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
21 | {-# LANGUAGE DeriveDataTypeable #-} | 21 | {-# LANGUAGE DeriveDataTypeable #-} |
22 | {-# LANGUAGE DeriveFunctor #-} | ||
22 | module Network.BitTorrent.Core.NodeInfo | 23 | module Network.BitTorrent.Core.NodeInfo |
23 | ( -- * Node ID | 24 | ( -- * Node ID |
24 | NodeId | 25 | NodeId |
@@ -143,7 +144,7 @@ distance (NodeId a) (NodeId b) = NodeDistance (BS.pack (BS.zipWith xor a b)) | |||
143 | data NodeAddr a = NodeAddr | 144 | data NodeAddr a = NodeAddr |
144 | { nodeHost :: !a | 145 | { nodeHost :: !a |
145 | , nodePort :: {-# UNPACK #-} !PortNumber | 146 | , nodePort :: {-# UNPACK #-} !PortNumber |
146 | } deriving (Eq, Typeable) | 147 | } deriving (Eq, Typeable, Functor) |
147 | 148 | ||
148 | $(deriveJSON omitRecordPrefix ''NodeAddr) | 149 | $(deriveJSON omitRecordPrefix ''NodeAddr) |
149 | 150 | ||
@@ -199,7 +200,7 @@ fromPeerAddr PeerAddr {..} = NodeAddr | |||
199 | data NodeInfo a = NodeInfo | 200 | data NodeInfo a = NodeInfo |
200 | { nodeId :: !NodeId | 201 | { nodeId :: !NodeId |
201 | , nodeAddr :: !(NodeAddr a) | 202 | , nodeAddr :: !(NodeAddr a) |
202 | } deriving (Show, Eq) | 203 | } deriving (Show, Eq, Functor) |
203 | 204 | ||
204 | $(deriveJSON omitRecordPrefix ''NodeInfo) | 205 | $(deriveJSON omitRecordPrefix ''NodeInfo) |
205 | 206 | ||