diff options
author | joe <joe@jerkface.net> | 2018-06-19 23:36:35 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-06-19 23:36:35 -0400 |
commit | 5294a47cc6af34d2e237f1ccb3b9aa69f1fa2032 (patch) | |
tree | 5f4736d5a704b02f0fab7a40001b1f8a59d5c6d7 /src | |
parent | 185d22daefbfb5a10789121baf6b4aaf35a7535b (diff) |
Added size method to Word64Map.
Diffstat (limited to 'src')
-rw-r--r-- | src/Data/Word64Map.hs | 4 |
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 | |||
6 | import Data.Bits | 6 | import Data.Bits |
7 | import qualified Data.IntMap as IntMap | 7 | import qualified Data.IntMap as IntMap |
8 | ;import Data.IntMap (IntMap) | 8 | ;import Data.IntMap (IntMap) |
9 | import Data.Monoid | ||
9 | import Data.Typeable | 10 | import Data.Typeable |
10 | import Data.Word | 11 | import Data.Word |
11 | 12 | ||
@@ -23,6 +24,9 @@ fitsInInt proxy = (original == casted) | |||
23 | 24 | ||
24 | newtype Word64Map a = Word64Map (IntMap (IntMap a)) | 25 | newtype Word64Map a = Word64Map (IntMap (IntMap a)) |
25 | 26 | ||
27 | size :: Word64Map a -> Int | ||
28 | size (Word64Map m) = getSum $ foldMap (\n -> Sum (IntMap.size n)) m | ||
29 | |||
26 | empty :: Word64Map a | 30 | empty :: Word64Map a |
27 | empty = Word64Map IntMap.empty | 31 | empty = Word64Map IntMap.empty |
28 | 32 | ||