type-indexed-queues-0.1.0.1: Queues with verified and unverified versions.

Safe HaskellSafe
LanguageHaskell2010

Data.Queue.Indexed.Pairing

Description

Size-indexed pairing heaps.

Synopsis

Documentation

data Pairing n a where Source #

A simple size-indexed pairing heap. In practice, this heap seems to have the best performance.

Inspired by the implementation here, but uses type-level literals, rather than type-level Peano numbers.

Constructors

E :: Pairing 0 a 
T :: a -> HVec n a -> Pairing (1 + n) a 

Instances

Ord a => MeldableIndexedQueue Pairing a Source # 

Methods

merge :: Pairing n a -> Pairing m a -> Pairing (n + m) a Source #

Ord a => IndexedQueue Pairing a Source # 

Methods

empty :: Pairing 0 a Source #

minView :: Pairing (1 + n) a -> (a, Pairing n a) Source #

singleton :: a -> Pairing 1 a Source #

insert :: a -> Pairing n a -> Pairing (1 + n) a Source #

minViewMay :: Pairing n a -> ((Nat ~ n) 0 -> b) -> (forall m. (Nat ~ (1 + m)) n => a -> Pairing m a -> b) -> b Source #

NFData a => NFData (Pairing n a) Source # 

Methods

rnf :: Pairing n a -> () #

data HVec n a where Source #

A size-indexed vector of pairing heaps.

Constructors

HNil :: HVec 0 a 
HCons :: Pairing m a -> HVec n a -> HVec (m + n) a 

Instances

NFData a => NFData (HVec n a) Source # 

Methods

rnf :: HVec n a -> () #