summaryrefslogtreecommitdiff
path: root/src/Data/Torrent/Tree.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Torrent/Tree.hs')
-rw-r--r--src/Data/Torrent/Tree.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Data/Torrent/Tree.hs b/src/Data/Torrent/Tree.hs
index e9a337a1..8c18041a 100644
--- a/src/Data/Torrent/Tree.hs
+++ b/src/Data/Torrent/Tree.hs
@@ -15,8 +15,8 @@ module Data.Torrent.Tree
15 , Data.Torrent.Tree.lookup 15 , Data.Torrent.Tree.lookup
16 , lookupDir 16 , lookupDir
17 17
18 , fileCount 18 , fileNumber
19 , dirCount 19 , dirNumber
20 ) where 20 ) where
21 21
22import Control.Arrow 22import Control.Arrow
@@ -62,10 +62,10 @@ lookupDir ps d
62 File _ -> Nothing 62 File _ -> Nothing
63 Dir es -> Just $ M.toList es 63 Dir es -> Just $ M.toList es
64 64
65fileCount :: DirTree a -> Sum Int 65fileNumber :: DirTree a -> Sum Int
66fileCount File {..} = Sum 1 66fileNumber File {..} = Sum 1
67fileCount Dir {..} = foldMap fileCount children 67fileNumber Dir {..} = foldMap fileNumber children
68 68
69dirCount :: DirTree a -> Sum Int 69dirNumber :: DirTree a -> Sum Int
70dirCount File {..} = Sum 0 70dirNumber File {..} = Sum 0
71dirCount Dir {..} = Sum 1 <> foldMap dirCount children 71dirNumber Dir {..} = Sum 1 <> foldMap dirNumber children