goblins-0.2.0.0: Genetic algorithm based randomised testing
Safe HaskellNone
LanguageHaskell2010

Test.Goblin.Persist

Description

Utilities for reading from / writing to the filesystem

Synopsis

Documentation

decodePopulation :: ByteString -> Population Bool Source #

Decode a `Population Bool` from a lazy ByteString.

encodePopulation :: Population Bool -> ByteString Source #

Encode a `Population Bool` to a lazy ByteString.

readFirstGenomeFromFile :: FilePath -> IO [Bool] Source #

Load a Population from a file and return the first (highest scoring) genome.

readPopulationFromFile :: FilePath -> IO (Population Bool) Source #

Read a Population from a file.

writePopulationToFile :: FilePath -> Population Bool -> IO () Source #

Write a Population to a file.

loadBestPopToShownByteString :: FilePath -> Q Exp Source #

Read a file at compile-time, and splice in the show of its ByteString as a String in the source file.

loadGoblinDataFromFilePath :: FilePath -> Q Exp Source #

Splice in a genome as a shown ByteString, and decode it at runtime. This is less safe than inlining the whole list of Bools into source code, but results in less source bloat.

integralToBits :: FiniteBits a => a -> [Bool] Source #

Convert an Integral into a little-endian binary representation.

integralFromBits :: forall a. (Integral a, FiniteBits a) => [Bool] -> a Source #

Convert from a little-endian binary representation to an Integral.

padBits :: Int -> [Bool] -> ([Bool], Int) Source #

Returns the padded list, plus the number of padding bits added.

splitter :: ([Word64], Int) -> [Bool] Source #

Split a list of Word64s, little-endian style, into their requisite bits. The Int describes the amount of padding to drop, since we must necessarily pad up to a 64-bit multiple.

grouper :: [Bool] -> ([Word64], Int) Source #

Group a list of Bools into a list of Word64s, little-endian style. The Int describes the amount of padding added, since we must necessarily pad up to a 64-bit multiple.