summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2013-12-01 21:12:40 +0100
committerDaniel Gröber <dxld@darkboxed.org>2013-12-01 21:12:40 +0100
commitb83c5d53be21c03004ebb65d1dc9fe1f841a2a3c (patch)
tree12d58df47e8b1a52173c72e97d29d3b8046fa309
parent2749007675a6ff28979fa793b48ffe910635c708 (diff)
Fix building with aeson >= 0.6.2.0
deriveJSON now takes an Option record instead of a single function. It might be nicer to define a function that takes the fieldLabelModifier function rather than doing it inline everywhere but I didn't know where a good place to put that would be.
-rw-r--r--bittorrent.cabal2
-rw-r--r--src/Data/Torrent.hs4
-rw-r--r--src/Data/Torrent/Block.hs2
-rw-r--r--src/Data/Torrent/Layout.hs4
-rw-r--r--src/Data/Torrent/Piece.hs4
-rw-r--r--src/Data/Torrent/Progress.hs2
-rw-r--r--src/Network/BitTorrent/Core/PeerAddr.hs2
-rw-r--r--src/Network/BitTorrent/Exchange/Status.hs2
-rw-r--r--src/Network/BitTorrent/Tracker/RPC/Message.hs8
9 files changed, 15 insertions, 15 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal
index acb28fa7..7f5a42ae 100644
--- a/bittorrent.cabal
+++ b/bittorrent.cabal
@@ -116,7 +116,7 @@ library
116 , hashable 116 , hashable
117 117
118 -- Codecs & Serialization 118 -- Codecs & Serialization
119 , aeson 119 , aeson >= 0.6.2.0
120 , base16-bytestring 120 , base16-bytestring
121 , base32-bytestring >= 0.2 121 , base32-bytestring >= 0.2
122 , base64-bytestring 122 , base64-bytestring
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index b3ac7586..7469d621 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" )
@@ -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/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
diff --git a/src/Network/BitTorrent/Core/PeerAddr.hs b/src/Network/BitTorrent/Core/PeerAddr.hs
index e58aaa89..ed2dc672 100644
--- a/src/Network/BitTorrent/Core/PeerAddr.hs
+++ b/src/Network/BitTorrent/Core/PeerAddr.hs
@@ -62,7 +62,7 @@ data PeerAddr = PeerAddr {
62 , peerPort :: {-# UNPACK #-} !PortNumber 62 , peerPort :: {-# UNPACK #-} !PortNumber
63 } deriving (Show, Eq, Ord, Typeable) 63 } deriving (Show, Eq, Ord, Typeable)
64 64
65$(deriveJSON (L.map toLower . L.dropWhile isLower) ''PeerAddr) 65$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''PeerAddr)
66 66
67-- | The tracker "announce query" compatible encoding. 67-- | The tracker "announce query" compatible encoding.
68instance BEncode PeerAddr where 68instance BEncode PeerAddr where
diff --git a/src/Network/BitTorrent/Exchange/Status.hs b/src/Network/BitTorrent/Exchange/Status.hs
index 7920f2a1..03a71bbe 100644
--- a/src/Network/BitTorrent/Exchange/Status.hs
+++ b/src/Network/BitTorrent/Exchange/Status.hs
@@ -35,7 +35,7 @@ data PeerStatus = PeerStatus {
35 } deriving (Show, Eq) 35 } deriving (Show, Eq)
36 36
37$(makeLenses ''PeerStatus) 37$(makeLenses ''PeerStatus)
38$(deriveJSON L.tail ''PeerStatus) 38$(deriveJSON defaultOptions { fieldLabelModifier = L.tail } ''PeerStatus)
39 39
40instance Default PeerStatus where 40instance Default PeerStatus where
41 def = PeerStatus True False 41 def = PeerStatus True False
diff --git a/src/Network/BitTorrent/Tracker/RPC/Message.hs b/src/Network/BitTorrent/Tracker/RPC/Message.hs
index cec68169..213f1e83 100644
--- a/src/Network/BitTorrent/Tracker/RPC/Message.hs
+++ b/src/Network/BitTorrent/Tracker/RPC/Message.hs
@@ -93,7 +93,7 @@ data Event = Started
93 -- ^ To be sent when the peer completes a download. 93 -- ^ To be sent when the peer completes a download.
94 deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable) 94 deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable)
95 95
96$(deriveJSON (L.map toLower . L.dropWhile isLower) ''Event) 96$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''Event)
97 97
98-- | HTTP tracker protocol compatible encoding. 98-- | HTTP tracker protocol compatible encoding.
99instance QueryValueLike Event where 99instance QueryValueLike Event where
@@ -163,7 +163,7 @@ data AnnounceQuery = AnnounceQuery
163 , reqEvent :: Maybe Event 163 , reqEvent :: Maybe Event
164 } deriving (Show, Eq, Typeable) 164 } deriving (Show, Eq, Typeable)
165 165
166$(deriveJSON (L.map toLower . L.dropWhile isLower) ''AnnounceQuery) 166$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''AnnounceQuery)
167 167
168-- | UDP tracker protocol compatible encoding. 168-- | UDP tracker protocol compatible encoding.
169instance Serialize AnnounceQuery where 169instance Serialize AnnounceQuery where
@@ -386,7 +386,7 @@ data AnnounceInfo =
386 , respWarning :: !(Maybe Text) 386 , respWarning :: !(Maybe Text)
387 } deriving (Show, Typeable) 387 } deriving (Show, Typeable)
388 388
389$(deriveJSON (L.map toLower . L.dropWhile isLower) ''AnnounceInfo) 389$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''AnnounceInfo)
390 390
391-- | HTTP tracker protocol compatible encoding. 391-- | HTTP tracker protocol compatible encoding.
392instance BEncode AnnounceInfo where 392instance BEncode AnnounceInfo where
@@ -524,7 +524,7 @@ data ScrapeEntry = ScrapeEntry {
524 , siName :: !(Maybe Text) 524 , siName :: !(Maybe Text)
525 } deriving (Show, Eq, Typeable) 525 } deriving (Show, Eq, Typeable)
526 526
527$(deriveJSON (L.map toLower . L.dropWhile isLower) ''ScrapeEntry) 527$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''ScrapeEntry)
528 528
529-- | HTTP tracker protocol compatible encoding. 529-- | HTTP tracker protocol compatible encoding.
530instance BEncode ScrapeEntry where 530instance BEncode ScrapeEntry where