From bd125ebfe61d475056b441c9e5790325be264c02 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 5 Dec 2013 05:03:11 +0400 Subject: Follow naming conventions in qualified imports --- src/Network/BitTorrent/Exchange/Block.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Network/BitTorrent/Exchange/Block.hs b/src/Network/BitTorrent/Exchange/Block.hs index e99dd49d..ca635a75 100644 --- a/src/Network/BitTorrent/Exchange/Block.hs +++ b/src/Network/BitTorrent/Exchange/Block.hs @@ -33,7 +33,7 @@ module Network.BitTorrent.Exchange.Block import Control.Applicative import Data.Aeson.TH -import qualified Data.ByteString.Lazy as Lazy +import Data.ByteString.Lazy as BL import Data.Char import Data.List as L import Data.Serialize as S @@ -138,26 +138,26 @@ data Block payload = Block { } deriving (Show, Eq, Functor, Typeable) -- | Payload is ommitted. -instance Pretty (Block Lazy.ByteString) where +instance Pretty (Block BL.ByteString) where pretty = pretty . blockIx {-# INLINE pretty #-} -- | Get size of block /payload/ in bytes. -blockSize :: Block Lazy.ByteString -> BlockSize -blockSize blk = fromIntegral (Lazy.length (blkData blk)) +blockSize :: Block BL.ByteString -> BlockSize +blockSize blk = fromIntegral (BL.length (blkData blk)) {-# INLINE blockSize #-} -- | Get block index of a block. -blockIx :: Block Lazy.ByteString -> BlockIx +blockIx :: Block BL.ByteString -> BlockIx blockIx = BlockIx <$> blkPiece <*> blkOffset <*> blockSize -- | Get location of payload bytes in the torrent content. -blockRange :: (Num a, Integral a) => PieceSize -> Block Lazy.ByteString -> (a, a) +blockRange :: (Num a, Integral a) => PieceSize -> Block BL.ByteString -> (a, a) blockRange pieceSize = blockIxRange pieceSize . blockIx {-# INLINE blockRange #-} -- | Test if a block can be safely turned into a piece. -isPiece :: PieceSize -> Block Lazy.ByteString -> Bool +isPiece :: PieceSize -> Block BL.ByteString -> Bool isPiece pieceLen blk @ (Block i offset _) = offset == 0 && blockSize blk == pieceLen && i >= 0 {-# INLINE isPiece #-} -- cgit v1.2.3