structures-0.2: "Advanced" Data Structures

Safe HaskellNone

Data.Vector.Bit

Contents

Synopsis

Bits

newtype Bit Source

A simple newtype around a Bool

The principal use of this is that a Vector Bit is densely packed into individual bits rather than stored as one entry per Word8.

Constructors

Bit 

Fields

getBit :: Bool
 

_Bit :: Iso' Bit BoolSource

Bit and Bool are isomorphic.

Bit Vectors with rank

data BitVector Source

A BitVector support for naïve O(1) rank.

Constructors

BitVector !Int !(Array Bit) !(Vector Int) 

_BitVector :: Iso' BitVector (Array Bit)Source

O(n) embedding A BitVector is isomorphic to a vector of bits. It just carries extra information.

rank :: BitVector -> Int -> IntSource

O(1). rank i v counts the number of True bits up through and including the position i

size :: BitVector -> IntSource

O(1). Return the size of the BitVector.

singleton :: Bool -> BitVectorSource

Construct a BitVector with a single element.

Vectors of Bits

data family MVector s a

data family Vector a