summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-01 12:32:49 -0800
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-01 12:32:49 -0800
commitf4fcc6c1970ec8d63e185e49dff65a6bd77011ad (patch)
tree5472de9cdb8afd6b15752f796ece829bf9e0316a /src/Data
parent2749007675a6ff28979fa793b48ffe910635c708 (diff)
parent5dc7a19e42da1ee1cc3570ca74a55c32d7d243e0 (diff)
Merge pull request #2 from DanielG/master
Fix building with aeson >= 0.6.2.0
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Torrent.hs8
-rw-r--r--src/Data/Torrent/Block.hs2
-rw-r--r--src/Data/Torrent/InfoHash.hs4
-rw-r--r--src/Data/Torrent/Layout.hs4
-rw-r--r--src/Data/Torrent/Piece.hs4
-rw-r--r--src/Data/Torrent/Progress.hs2
6 files changed, 12 insertions, 12 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index b3ac7586..ce919907 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -123,7 +123,7 @@ data InfoDict = InfoDict
123 -- BEP 27: <http://www.bittorrent.org/beps/bep_0027.html> 123 -- BEP 27: <http://www.bittorrent.org/beps/bep_0027.html>
124 } deriving (Show, Read, Eq, Typeable) 124 } deriving (Show, Read, Eq, Typeable)
125 125
126$(deriveJSON (L.map Char.toLower . L.dropWhile isLower) ''InfoDict) 126$(deriveJSON defaultOptions { fieldLabelModifier = (L.map Char.toLower . L.dropWhile isLower) } ''InfoDict)
127 127
128makeLensesFor 128makeLensesFor
129 [ ("idInfoHash" , "infohash" ) 129 [ ("idInfoHash" , "infohash" )
@@ -137,8 +137,8 @@ instance NFData InfoDict where
137 rnf InfoDict {..} = rnf idLayoutInfo 137 rnf InfoDict {..} = rnf idLayoutInfo
138 138
139instance Hashable InfoDict where 139instance Hashable InfoDict where
140 hash = Hashable.hash . idInfoHash 140 hashWithSalt = Hashable.hashUsing idInfoHash
141 {-# INLINE hash #-} 141 {-# INLINE hashWithSalt #-}
142 142
143-- | Smart constructor: add a info hash to info dictionary. 143-- | Smart constructor: add a info hash to info dictionary.
144infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict 144infoDictionary :: LayoutInfo -> PieceInfo -> Bool -> InfoDict
@@ -239,7 +239,7 @@ instance ToJSON NominalDiffTime where
239instance FromJSON NominalDiffTime where 239instance FromJSON NominalDiffTime where
240 parseJSON v = utcTimeToPOSIXSeconds <$> parseJSON v 240 parseJSON v = utcTimeToPOSIXSeconds <$> parseJSON v
241 241
242$(deriveJSON (L.map Char.toLower . L.dropWhile isLower) ''Torrent) 242$(deriveJSON defaultOptions { fieldLabelModifier = (L.map Char.toLower . L.dropWhile isLower) } ''Torrent)
243 243
244makeLensesFor 244makeLensesFor
245 [ ("tAnnounce" , "announce" ) 245 [ ("tAnnounce" , "announce" )
diff --git a/src/Data/Torrent/Block.hs b/src/Data/Torrent/Block.hs
index 37889a7a..fd12b7a0 100644
--- a/src/Data/Torrent/Block.hs
+++ b/src/Data/Torrent/Block.hs
@@ -97,7 +97,7 @@ data BlockIx = BlockIx {
97 , ixLength :: {-# UNPACK #-} !BlockSize 97 , ixLength :: {-# UNPACK #-} !BlockSize
98 } deriving (Show, Eq) 98 } deriving (Show, Eq)
99 99
100$(deriveJSON (L.map toLower . L.dropWhile isLower) ''BlockIx) 100$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''BlockIx)
101 101
102getInt :: S.Get Int 102getInt :: S.Get Int
103getInt = fromIntegral <$> S.getWord32be 103getInt = fromIntegral <$> S.getWord32be
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
70 70
71-- | Hash raw bytes. (no encoding) 71-- | Hash raw bytes. (no encoding)
72instance Hashable InfoHash where 72instance Hashable InfoHash where
73 hash (InfoHash ih) = Hashable.hash ih 73 hashWithSalt s (InfoHash ih) = hashWithSalt s ih
74 {-# INLINE hash #-} 74 {-# INLINE hashWithSalt #-}
75 75
76-- | Convert to\/from raw bencoded string. (no encoding) 76-- | Convert to\/from raw bencoded string. (no encoding)
77instance BEncode InfoHash where 77instance BEncode InfoHash where
diff --git a/src/Data/Torrent/Layout.hs b/src/Data/Torrent/Layout.hs
index 8f35772d..d39c6c04 100644
--- a/src/Data/Torrent/Layout.hs
+++ b/src/Data/Torrent/Layout.hs
@@ -125,7 +125,7 @@ data FileInfo a = FileInfo {
125 , Functor, Foldable 125 , Functor, Foldable
126 ) 126 )
127 127
128$(deriveJSON (L.map Char.toLower . L.dropWhile isLower) ''FileInfo) 128$(deriveJSON defaultOptions { fieldLabelModifier = (L.map Char.toLower . L.dropWhile isLower) } ''FileInfo)
129 129
130makeLensesFor 130makeLensesFor
131 [ ("fiLength", "fileLength") 131 [ ("fiLength", "fileLength")
@@ -210,7 +210,7 @@ data LayoutInfo
210 , liDirName :: !ByteString 210 , liDirName :: !ByteString
211 } deriving (Show, Read, Eq, Typeable) 211 } deriving (Show, Read, Eq, Typeable)
212 212
213$(deriveJSON (L.map Char.toLower . L.dropWhile isLower) ''LayoutInfo) 213$(deriveJSON defaultOptions { fieldLabelModifier = (L.map Char.toLower . L.dropWhile isLower) } ''LayoutInfo)
214 214
215makeLensesFor 215makeLensesFor
216 [ ("liFile" , "singleFile" ) 216 [ ("liFile" , "singleFile" )
diff --git a/src/Data/Torrent/Piece.hs b/src/Data/Torrent/Piece.hs
index 7eb4e3d5..f7c6257b 100644
--- a/src/Data/Torrent/Piece.hs
+++ b/src/Data/Torrent/Piece.hs
@@ -117,7 +117,7 @@ data Piece a = Piece
117 , pieceData :: !a 117 , pieceData :: !a
118 } deriving (Show, Read, Eq, Typeable) 118 } deriving (Show, Read, Eq, Typeable)
119 119
120$(deriveJSON (L.map toLower . L.dropWhile isLower) ''Piece) 120$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''Piece)
121 121
122instance NFData (Piece a) 122instance NFData (Piece a)
123 123
@@ -160,7 +160,7 @@ data PieceInfo = PieceInfo
160 -- ^ Concatenation of all 20-byte SHA1 hash values. 160 -- ^ Concatenation of all 20-byte SHA1 hash values.
161 } deriving (Show, Read, Eq, Typeable) 161 } deriving (Show, Read, Eq, Typeable)
162 162
163$(deriveJSON (L.map toLower . L.dropWhile isLower) ''PieceInfo) 163$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''PieceInfo)
164 164
165-- | Number of bytes in each piece. 165-- | Number of bytes in each piece.
166makeLensesFor [("piPieceLength", "pieceLength")] ''PieceInfo 166makeLensesFor [("piPieceLength", "pieceLength")] ''PieceInfo
diff --git a/src/Data/Torrent/Progress.hs b/src/Data/Torrent/Progress.hs
index 1a4a68e2..34f8f299 100644
--- a/src/Data/Torrent/Progress.hs
+++ b/src/Data/Torrent/Progress.hs
@@ -62,7 +62,7 @@ data Progress = Progress
62 } deriving (Show, Read, Eq) 62 } deriving (Show, Read, Eq)
63 63
64$(makeLenses ''Progress) 64$(makeLenses ''Progress)
65$(deriveJSON L.tail ''Progress) 65$(deriveJSON defaultOptions { fieldLabelModifier = L.tail } ''Progress)
66 66
67-- | UDP tracker compatible encoding. 67-- | UDP tracker compatible encoding.
68instance Serialize Progress where 68instance Serialize Progress where