From 9a73e365f4c29080ab6ce04290b36e3189171289 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Mon, 2 Dec 2013 00:55:02 +0400 Subject: A little bit more informative ty syn name --- src/Data/Torrent/Layout.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Data') diff --git a/src/Data/Torrent/Layout.hs b/src/Data/Torrent/Layout.hs index 8f35772d..54ec0f23 100644 --- a/src/Data/Torrent/Layout.hs +++ b/src/Data/Torrent/Layout.hs @@ -50,7 +50,7 @@ module Data.Torrent.Layout , blockCount -- * Flat file layout - , Layout + , FileLayout , flatLayout , accumOffsets , fileOffset @@ -286,13 +286,13 @@ blockCount blkSize ci = contentLength ci `sizeInBase` blkSize -- coalesce all the files in the given order to get the linear block -- address space. -- -type Layout a = [(FilePath, a)] +type FileLayout a = [(FilePath, a)] -- | Extract files layout from torrent info with the given root path. flatLayout - :: FilePath -- ^ Root path for the all torrent files. - -> LayoutInfo -- ^ Torrent content information. - -> Layout FileSize -- ^ The all file paths prefixed with the given root. + :: FilePath -- ^ Root path for the all torrent files. + -> LayoutInfo -- ^ Torrent content information. + -> FileLayout FileSize -- ^ The all file paths prefixed with the given root. flatLayout prefixPath SingleFile { liFile = FileInfo {..} } = [(prefixPath BC.unpack fiName, fiLength)] flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles @@ -303,14 +303,14 @@ flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles joinPath (L.map BC.unpack fiName) -- | Calculate offset of each file based on its length, incrementally. -accumOffsets :: Layout FileSize -> Layout FileOffset +accumOffsets :: FileLayout FileSize -> FileLayout FileOffset accumOffsets = go 0 where go !_ [] = [] go !offset ((n, s) : xs) = (n, offset) : go (offset + s) xs -- | Gives global offset of a content file for a given full path. -fileOffset :: FilePath -> Layout FileOffset -> Maybe FileOffset +fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset fileOffset = lookup {-# INLINE fileOffset #-} -- cgit v1.2.3