From 5dc7a19e42da1ee1cc3570ca74a55c32d7d243e0 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 1 Dec 2013 21:19:35 +0100 Subject: Fix building with hashable >= 1.2 hashWithSalt is now the minimal implementation --- src/Data/Torrent.hs | 4 ++-- src/Data/Torrent/InfoHash.hs | 4 ++-- src/Network/BitTorrent/Core/PeerId.hs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs index 7469d621..ce919907 100644 --- a/src/Data/Torrent.hs +++ b/src/Data/Torrent.hs @@ -137,8 +137,8 @@ instance NFData InfoDict where rnf InfoDict {..} = rnf idLayoutInfo instance Hashable InfoDict where - hash = Hashable.hash . idInfoHash - {-# INLINE hash #-} + hashWithSalt = Hashable.hashUsing idInfoHash + {-# INLINE hashWithSalt #-} -- | Smart constructor: add a info hash to info dictionary. infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict diff --git a/src/Data/Torrent/InfoHash.hs b/src/Data/Torrent/InfoHash.hs index d840ac87..4d49fcb7 100644 --- a/src/Data/Torrent/InfoHash.hs +++ b/src/Data/Torrent/InfoHash.hs @@ -70,8 +70,8 @@ instance Default InfoHash where -- | Hash raw bytes. (no encoding) instance Hashable InfoHash where - hash (InfoHash ih) = Hashable.hash ih - {-# INLINE hash #-} + hashWithSalt s (InfoHash ih) = hashWithSalt s ih + {-# INLINE hashWithSalt #-} -- | Convert to\/from raw bencoded string. (no encoding) instance BEncode InfoHash where diff --git a/src/Network/BitTorrent/Core/PeerId.hs b/src/Network/BitTorrent/Core/PeerId.hs index 148f550d..1b4409a8 100644 --- a/src/Network/BitTorrent/Core/PeerId.hs +++ b/src/Network/BitTorrent/Core/PeerId.hs @@ -74,8 +74,8 @@ peerIdLen :: Int peerIdLen = 20 instance Hashable PeerId where - hash = hash . getPeerId - {-# INLINE hash #-} + hashWithSalt = hashUsing getPeerId + {-# INLINE hashWithSalt #-} instance Serialize PeerId where put = putByteString . getPeerId -- cgit v1.2.3