HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulecontainers-0.7Haskell2010

Utils.Containers.Internal.BitQueue

WARNING

This module is considered internal.

The Package Versioning Policy does not apply.

The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.

Authors importing this module are expected to track development closely.

Description

An extremely light-weight, fast, and limited representation of a string of up to (2*WORDSIZE - 2) bits. In fact, there are two representations, misleadingly named bit queue builder and bit queue. The builder supports only emptyQB, creating an empty builder, and snocQB, enqueueing a bit. The bit queue builder is then turned into a bit queue using buildQ, after which bits can be removed one by one using unconsQ. If the size limit is exceeded, further operations will silently produce nonsense.

  • 2 types
  • 5 values
  • Packagecontainers-0.7
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceBitQueue.hs
newtypenewtype BitQueue
#
Instances1Show
  • Show BitQueueDefined in containers-0.7 · Utils.Containers.Internal.BitQueue
datadata BitQueueB
#
Instances1Show
  • Show BitQueueBDefined in containers-0.7 · Utils.Containers.Internal.BitQueue
valueemptyQB :: BitQueueB
#

Create an empty bit queue builder. This is represented as a single guard bit in the most significant position.

valuesnocQB :: BitQueueB -> Bool -> BitQueueB
#

Enqueue a bit. This works by shifting the queue right one bit, then setting the most significant bit as requested.

valuebuildQ :: BitQueueB -> BitQueue
#

Convert a bit queue builder to a bit queue. This shifts in a new guard bit on the left, and shifts right until the old guard bit falls off.

valuetoListQ :: BitQueue -> [Bool]
#

Convert a bit queue to a list of bits by unconsing. This is used to test that the queue functions properly.