HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulerio-0.1.22.0Haskell2010

RIO.Deque

  • 4 types
  • 14 values
  • Packagerio-0.1.22.0
  • Exports18
  • LanguageHaskell2010
  • LicenceMIT
  • SourceDeque.hs

Types

4 declarations
newtypenewtype Deque (v :: Type -> Type -> Type) s a
#

A double-ended queue supporting any underlying vector type and any monad.

This implements a circular double-ended queue with exponential growth.

Operations

11 declarations
valuedequeToVector
  1. :: (Vector v' a, MVector v a, PrimMonad m)
  2. => Deque v (PrimState m) a
  3. -> m (v' a)
#

Convert to an immutable vector of any type. If resulting pure vector corresponds to the mutable one used by the Deque, it will be more efficient to use freezeDeque instead.

Example
Example6 expressions
:set -XTypeApplicationsimport qualified RIO.Vector.Unboxed as Uimport qualified RIO.Vector.Storable as Sd <- newDeque @U.MVector @IntmapM_ (pushFrontDeque d) [0..10]dequeToVector @S.Vector d[10,9,8,7,6,5,4,3,2,1,0]
valuefreezeDeque
  1. :: (Vector v a, PrimMonad m)
  2. => Deque (Mutable v) (PrimState m) a
  3. -> m (v a)
#

Yield an immutable copy of the underlying mutable vector. The difference from dequeToVector is that the the copy will be performed with a more efficient memcpy, rather than element by element. The downside is that the resulting vector type must be the one that corresponds to the mutable one that is used in the Deque.

Example
Example5 expressions
:set -XTypeApplicationsimport qualified RIO.Vector.Unboxed as Ud <- newDeque @U.MVector @IntmapM_ (pushFrontDeque d) [0..10]freezeDeque @U.Vector d[10,9,8,7,6,5,4,3,2,1,0]

Inference helpers

3 declarations
valueasUDeque :: UDeque s a -> UDeque s a
#

Helper function to assist with type inference, forcing usage of an unboxed vector.

valueasSDeque :: SDeque s a -> SDeque s a
#

Helper function to assist with type inference, forcing usage of a storable vector.

valueasBDeque :: BDeque s a -> BDeque s a
#

Helper function to assist with type inference, forcing usage of a boxed vector.