heftia-0.7.0.0: higher-order algebraic effects done right
Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King
LicenseBSD3
MaintainerAlexis King <lexi.lambda@gmail.com>
Stabilityexperimental
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageGHC2021

Data.FTCQueue

Description

  • Constant-time append/(><) and snoc/(|>)
  • Average constant-time viewL (left-edge deconstruction).

Using http://okmij.org/ftp/Haskell/extensible/FTCQueue1.hs as a starting point.

A minimal version of FTCQueue from "Reflection w/o Remorse":

Synopsis

Documentation

data FTCQueue (m :: Type -> Type) a b Source #

Non-empty tree. Deconstruction operations make it more and more left-leaning

Instances

Instances details
Applicative f => Category (FTCQueue f :: Type -> Type -> Type) Source # 
Instance details

Defined in Data.FTCQueue

Methods

id :: FTCQueue f a a #

(.) :: FTCQueue f b c -> FTCQueue f a b -> FTCQueue f a c #

tsingleton :: (a -> m b) -> FTCQueue m a b Source #

Build a leaf from a single operation. [O(1)]

(|>) :: FTCQueue m a x -> (x -> m b) -> FTCQueue m a b Source #

Append an operation to the right of the tree. [O(1)]

snoc :: FTCQueue m a x -> (x -> m b) -> FTCQueue m a b Source #

An alias for (|>)

(><) :: forall (m :: Type -> Type) a x b. FTCQueue m a x -> FTCQueue m x b -> FTCQueue m a b Source #

Append two trees of operations. [O(1)]

append :: forall (m :: Type -> Type) a x b. FTCQueue m a x -> FTCQueue m x b -> FTCQueue m a b Source #

An alias for (><)

data ViewL (m :: Type -> Type) a b where Source #

Left view deconstruction data structure.

Constructors

TOne :: forall a (m :: Type -> Type) b. (a -> m b) -> ViewL m a b 
(:|) :: forall a (m :: Type -> Type) x b. (a -> m x) -> FTCQueue m x b -> ViewL m a b 

tviewl :: forall (m :: Type -> Type) a b. FTCQueue m a b -> ViewL m a b Source #

Left view deconstruction. [average O(1)]