battleship-combinatorics-0.0.0.1: Compute number of possible arrangements in the battleship game

Safe HaskellNone
LanguageHaskell98

Combinatorics.Battleship.Count.CountMap

Synopsis

Documentation

data T w a Source #

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

Instances

(Eq a, Storable a) => Eq (T w a) Source # 

Methods

(==) :: T w a -> T w a -> Bool #

(/=) :: T w a -> T w a -> Bool #

(Nat w, Show a, Storable a) => Show (T w a) Source # 

Methods

showsPrec :: Int -> T w a -> ShowS #

show :: T w a -> String #

showList :: [T w a] -> ShowS #

(C a, Storable a) => Monoid (T w a) Source # 

Methods

mempty :: T w a #

mappend :: T w a -> T w a -> T w a #

mconcat :: [T w a] -> T w a #

Storable a => NFData (T w a) Source # 

Methods

rnf :: T w a -> () #

type KeyCount w a = (Key w, a) Source #

newtype Path w a Source #

Constructors

Path FilePath 

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.

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

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

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

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.

writeSorted :: (C a, Storable a) => Path w a -> [[KeyCount w a]] -> IO () Source #

fromMap :: Storable a => Map (Key w) a -> T w a Source #

singleton :: Storable a => Key w -> a -> T w a Source #

size :: T w a -> Int Source #

toAscList :: Storable a => T w a -> [KeyCount w a] Source #

toMap :: Storable a => T w a -> Map (Key w) a Source #

mergeMany :: (C a, Storable a) => [T w a] -> T w a Source #

propMerge :: [KeyCount N10 Count64] -> [KeyCount N10 Count64] -> Bool Source #