summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-19 23:36:35 -0400
committerjoe <joe@jerkface.net>2018-06-19 23:36:35 -0400
commit5294a47cc6af34d2e237f1ccb3b9aa69f1fa2032 (patch)
tree5f4736d5a704b02f0fab7a40001b1f8a59d5c6d7 /src/Data
parent185d22daefbfb5a10789121baf6b4aaf35a7535b (diff)
Added size method to Word64Map.
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Word64Map.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Data/Word64Map.hs b/src/Data/Word64Map.hs
index 9e93c8c8..adc9c27e 100644
--- a/src/Data/Word64Map.hs
+++ b/src/Data/Word64Map.hs
@@ -6,6 +6,7 @@ module Data.Word64Map where
6import Data.Bits 6import Data.Bits
7import qualified Data.IntMap as IntMap 7import qualified Data.IntMap as IntMap
8 ;import Data.IntMap (IntMap) 8 ;import Data.IntMap (IntMap)
9import Data.Monoid
9import Data.Typeable 10import Data.Typeable
10import Data.Word 11import Data.Word
11 12
@@ -23,6 +24,9 @@ fitsInInt proxy = (original == casted)
23 24
24newtype Word64Map a = Word64Map (IntMap (IntMap a)) 25newtype Word64Map a = Word64Map (IntMap (IntMap a))
25 26
27size :: Word64Map a -> Int
28size (Word64Map m) = getSum $ foldMap (\n -> Sum (IntMap.size n)) m
29
26empty :: Word64Map a 30empty :: Word64Map a
27empty = Word64Map IntMap.empty 31empty = Word64Map IntMap.empty
28 32