goat-1.0.0: Time Series Compression

Copyright(c) Daniel Lovasko 2016-2017
LicenseBSD3
MaintainerDaniel Lovasko <daniel.lovasko@gmail.com>
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Codec.Goat.Util

Description

Various utility functions used throughout the codebase.

Synopsis

Documentation

aiGetByteString Source #

Arguments

:: Get ByteString

reader

Architecture-independent deserialization of a lazy ByteString.

aiPutByteString Source #

Arguments

:: ByteString

bytestring to parse

-> Put

writer

Architecture-independent serialization of a strict ByteString.

bool Source #

Arguments

:: a

True option

-> a

False option

-> Bool

bool

-> a

result

Functional equivalent of the 'if/then/else' construct.

first Source #

Arguments

:: (a -> b)

function

-> (a, x)

old pair

-> (b, x)

new pair

Apply a function to the first element of a pair.

fromBools Source #

Arguments

:: (Num b, FiniteBits b) 
=> [Bool]

bits

-> b

Bits instance

Convert a list of bools into a Bits instance.

inBounds Source #

Arguments

:: Ord a 
=> (a, a)

bounds

-> a

value

-> Bool

decision

Check whether a value falls between the bounds (inclusive).

packBits Source #

Arguments

:: [Bool]

bits

-> ByteString

bytestring

Pack a list of bits into a more compact form.

select Source #

Arguments

:: [a]

list

-> [Bool]

presence flags

-> [a]

filtered list

Select only certain elements from the list based on the boolean values.

sub Source #

Arguments

:: Word32

first word

-> Word32

second word

-> Int64

result

Correct subtraction of two unsigned integers.

toBools Source #

Arguments

:: FiniteBits b 
=> b

Bits instance

-> [Bool]

bits

Convert a Bits instance into a list of bools.

unpackBits Source #

Arguments

:: ByteString

bits

-> [Bool]

bytestring

Unpack a compact block of bytes into a list of bools.