Safe Haskell | None |
---|---|

Language | Haskell98 |

## Synopsis

- data T w a
- type KeyCount w a = (Key w, a)
- newtype Path w a = Path FilePath
- readFile :: Storable a => Path w a -> IO (T w a)
- writeFile :: Storable a => Path w a -> T w a -> IO ()
- fromList :: (C a, Storable a) => [KeyCount w a] -> T w a
- fromListStorable :: (C a, Storable a) => [KeyCount w a] -> T w a
- fromListExternal :: (C a, Storable a) => Int -> [KeyCount w a] -> IO (T w a)
- writeSorted :: (C a, Storable a) => Path w a -> [[KeyCount w a]] -> IO ()
- fromMap :: Storable a => Map (Key w) a -> T w a
- singleton :: Storable a => Key w -> a -> T w a
- size :: T w a -> Int
- toAscList :: Storable a => T w a -> [KeyCount w a]
- toMap :: Storable a => T w a -> Map (Key w) a
- mergeMany :: (C a, Storable a) => [T w a] -> T w a
- propMerge :: [KeyCount N10 Count64] -> [KeyCount N10 Count64] -> Bool

# Documentation

Represents a `Map Key Count`

by a lazy ByteString containing the (key,count) pairs in ascending order.

readFile :: Storable a => Path w a -> IO (T w a) Source #

It silently drops IO exceptions and does not check whether the loaded data is valid.

fromListExternal :: (C a, Storable a) => Int -> [KeyCount w a] -> IO (T w a) Source #

Create a `CountMap`

from a large list of elements.
Neither the argument nor the result needs to fit in memory.
You only have to provide enough space on disk.
The result is lazily read from a temporary file.
That is, this file should neither be modified
nor deleted while processing the result.
Even more, `fromListExternal`

must not be called again
while processing the result.
You may better choose `writeSorted`

.