bitarray-0.0.1.1: Mutable and immutable bit arrays

Safe Haskell | None
Language | Haskell98

Data.BitArray

Contents

- Bit array construction / deconstruction
- 0/1 versions
- Orphan instances

Description

Immutable one-dimensional packed bit arrays. The main advantage should be compactness in memory.

Synopsis

- data BitArray
- bitArrayBounds :: BitArray -> (Int, Int)
- lookupBit :: BitArray -> Int -> Bool
- unsafeLookupBit :: BitArray -> Int -> Bool
- bitArray :: (Int, Int) -> [(Int, Bool)] -> BitArray
- bitArray' :: Bool -> (Int, Int) -> [(Int, Bool)] -> BitArray
- accumBitArray :: (Bool -> a -> Bool) -> Bool -> (Int, Int) -> [(Int, a)] -> BitArray
- listBitArray :: (Int, Int) -> [Bool] -> BitArray
- bits :: BitArray -> [Bool]
- bits01 :: BitArray -> [Int]
- listBitArray01 :: (Int, Int) -> [Int] -> BitArray

# Documentation

data BitArray #

A packed bit array. Internally, it is represented as an unboxed array of `Word64`-s.

#### Instances

Instances details

Eq BitArray # |
Instance details Defined in Data.BitArray Methods (==) :: BitArray -> BitArray -> Bool # (/=) :: BitArray -> BitArray -> Bool #
Ord BitArray # |
Instance details Defined in Data.BitArray Methods compare :: BitArray -> BitArray -> Ordering # (<) :: BitArray -> BitArray -> Bool # (<=) :: BitArray -> BitArray -> Bool # (>) :: BitArray -> BitArray -> Bool # (>=) :: BitArray -> BitArray -> Bool # max :: BitArray -> BitArray -> BitArray # min :: BitArray -> BitArray -> BitArray #
Show BitArray # |
Instance details Defined in Data.BitArray Methods showsPrec :: Int -> BitArray -> ShowS # show :: BitArray -> String # showList :: [BitArray] -> ShowS #

bitArrayBounds :: BitArray -> (Int, Int) #

lookupBit :: BitArray -> Int -> Bool #

unsafeLookupBit :: BitArray -> Int -> Bool #

# Bit array construction / deconstruction

bitArray :: (Int, Int) -> [(Int, Bool)] -> BitArray #

Unspecified values become `False`.

bitArray' :: Bool -> (Int, Int) -> [(Int, Bool)] -> BitArray #

The first argument gives the default value (instead of `False`)

accumBitArray :: (Bool -> a -> Bool) -> Bool -> (Int, Int) -> [(Int, a)] -> BitArray #

listBitArray :: (Int, Int) -> [Bool] -> BitArray #

If the list is too short, the rest of the array is filled with `False`.

bits :: BitArray -> [Bool] #

# 0/1 versions

bits01 :: BitArray -> [Int] #

listBitArray01 :: (Int, Int) -> [Int] -> BitArray #

# Orphan instances

Eq BitArray # |
Instance details Methods (==) :: BitArray -> BitArray -> Bool # (/=) :: BitArray -> BitArray -> Bool #
Ord BitArray # |
Instance details Methods compare :: BitArray -> BitArray -> Ordering # (<) :: BitArray -> BitArray -> Bool # (<=) :: BitArray -> BitArray -> Bool # (>) :: BitArray -> BitArray -> Bool # (>=) :: BitArray -> BitArray -> Bool # max :: BitArray -> BitArray -> BitArray # min :: BitArray -> BitArray -> BitArray #
Show BitArray # |
Instance details Methods showsPrec :: Int -> BitArray -> ShowS # show :: BitArray -> String # showList :: [BitArray] -> ShowS #