summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-12 05:54:27 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-12 05:54:27 +0400
commit83f1ae21c639dcc21b5ce160804ac77587b1db16 (patch)
tree5cca9be9afa63a4a0047d9337f965de293154b1a /src/Network
parent72b5356bd146dc2cc55fb8b7770044a26c423e0d (diff)
Add default instance for Block
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/Exchange/Block.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Exchange/Block.hs b/src/Network/BitTorrent/Exchange/Block.hs
index d06fe727..8e3ef91f 100644
--- a/src/Network/BitTorrent/Exchange/Block.hs
+++ b/src/Network/BitTorrent/Exchange/Block.hs
@@ -35,6 +35,7 @@ import Control.Applicative
35import Data.Aeson.TH 35import Data.Aeson.TH
36import Data.ByteString.Lazy as BL 36import Data.ByteString.Lazy as BL
37import Data.Char 37import Data.Char
38import Data.Default
38import Data.List as L 39import Data.List as L
39import Data.Serialize as S 40import Data.Serialize as S
40import Data.Typeable 41import Data.Typeable
@@ -87,6 +88,10 @@ data BlockIx = BlockIx {
87 88
88$(deriveJSON omitRecordPrefix ''BlockIx) 89$(deriveJSON omitRecordPrefix ''BlockIx)
89 90
91-- | First block in torrent. Useful for debugging.
92instance Default BlockIx where
93 def = BlockIx 0 0 defaultTransferSize
94
90getInt :: S.Get Int 95getInt :: S.Get Int
91getInt = fromIntegral <$> S.getWord32be 96getInt = fromIntegral <$> S.getWord32be
92{-# INLINE getInt #-} 97{-# INLINE getInt #-}