diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT')
-rw-r--r-- | src/Network/BitTorrent/DHT/ContactInfo.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT/ContactInfo.hs b/src/Network/BitTorrent/DHT/ContactInfo.hs index dfc93ed7..ed38caf7 100644 --- a/src/Network/BitTorrent/DHT/ContactInfo.hs +++ b/src/Network/BitTorrent/DHT/ContactInfo.hs | |||
@@ -15,6 +15,7 @@ import Data.List as L | |||
15 | import Data.Maybe | 15 | import Data.Maybe |
16 | import Data.HashMap.Strict as HM | 16 | import Data.HashMap.Strict as HM |
17 | import Data.Serialize | 17 | import Data.Serialize |
18 | import Data.Semigroup | ||
18 | import Data.Wrapper.PSQ as PSQ | 19 | import Data.Wrapper.PSQ as PSQ |
19 | import Data.Time.Clock.POSIX | 20 | import Data.Time.Clock.POSIX |
20 | import Data.ByteString (ByteString) | 21 | import Data.ByteString (ByteString) |
@@ -190,6 +191,11 @@ instance Default (PeerStore) where | |||
190 | def = PeerStore HM.empty | 191 | def = PeerStore HM.empty |
191 | {-# INLINE def #-} | 192 | {-# INLINE def #-} |
192 | 193 | ||
194 | instance Semigroup PeerStore where | ||
195 | PeerStore a <> PeerStore b = | ||
196 | PeerStore (HM.unionWith swarmInsert a b) | ||
197 | {-# INLINE (<>) #-} | ||
198 | |||
193 | -- | Monoid under union operation. | 199 | -- | Monoid under union operation. |
194 | instance Monoid PeerStore where | 200 | instance Monoid PeerStore where |
195 | mempty = def | 201 | mempty = def |