From b83c5d53be21c03004ebb65d1dc9fe1f841a2a3c Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 1 Dec 2013 21:12:40 +0100 Subject: 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. --- src/Data/Torrent/Block.hs | 2 +- src/Data/Torrent/Layout.hs | 4 ++-- src/Data/Torrent/Piece.hs | 4 ++-- src/Data/Torrent/Progress.hs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Data/Torrent') 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 { , ixLength :: {-# UNPACK #-} !BlockSize } deriving (Show, Eq) -$(deriveJSON (L.map toLower . L.dropWhile isLower) ''BlockIx) +$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''BlockIx) getInt :: S.Get Int getInt = 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 { , Functor, Foldable ) -$(deriveJSON (L.map Char.toLower . L.dropWhile isLower) ''FileInfo) +$(deriveJSON defaultOptions { fieldLabelModifier = (L.map Char.toLower . L.dropWhile isLower) } ''FileInfo) makeLensesFor [ ("fiLength", "fileLength") @@ -210,7 +210,7 @@ data LayoutInfo , liDirName :: !ByteString } deriving (Show, Read, Eq, Typeable) -$(deriveJSON (L.map Char.toLower . L.dropWhile isLower) ''LayoutInfo) +$(deriveJSON defaultOptions { fieldLabelModifier = (L.map Char.toLower . L.dropWhile isLower) } ''LayoutInfo) makeLensesFor [ ("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 , pieceData :: !a } deriving (Show, Read, Eq, Typeable) -$(deriveJSON (L.map toLower . L.dropWhile isLower) ''Piece) +$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''Piece) instance NFData (Piece a) @@ -160,7 +160,7 @@ data PieceInfo = PieceInfo -- ^ Concatenation of all 20-byte SHA1 hash values. } deriving (Show, Read, Eq, Typeable) -$(deriveJSON (L.map toLower . L.dropWhile isLower) ''PieceInfo) +$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''PieceInfo) -- | Number of bytes in each piece. makeLensesFor [("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 } deriving (Show, Read, Eq) $(makeLenses ''Progress) -$(deriveJSON L.tail ''Progress) +$(deriveJSON defaultOptions { fieldLabelModifier = L.tail } ''Progress) -- | UDP tracker compatible encoding. instance Serialize Progress where -- cgit v1.2.3