sparse-set-0.3.0: Sparse set data structure
Copyright(c) Matt Hunzinger 2025
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainermatt@hunzinger.me
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.SparseSet

Description

 
Synopsis

Sparse sets

data SparseSet i a Source #

Constructors

SparseSet 

Fields

Instances

Instances details
Generic (SparseSet i a) Source # 
Instance details

Defined in Data.SparseSet

Associated Types

type Rep (SparseSet i a) 
Instance details

Defined in Data.SparseSet

type Rep (SparseSet i a) = D1 ('MetaData "SparseSet" "Data.SparseSet" "sparse-set-0.3.0-9e4aezLoPlHECzYnIPXBuf" 'False) (C1 ('MetaCons "SparseSet" 'PrefixI 'True) (S1 ('MetaSel ('Just "dense") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector a)) :*: S1 ('MetaSel ('Just "sparse") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SparseVector i))))

Methods

from :: SparseSet i a -> Rep (SparseSet i a) x #

to :: Rep (SparseSet i a) x -> SparseSet i a #

(Show a, Show i) => Show (SparseSet i a) Source # 
Instance details

Defined in Data.SparseSet

Methods

showsPrec :: Int -> SparseSet i a -> ShowS #

show :: SparseSet i a -> String #

showList :: [SparseSet i a] -> ShowS #

(NFData a, NFData i) => NFData (SparseSet i a) Source # 
Instance details

Defined in Data.SparseSet

Methods

rnf :: SparseSet i a -> () #

(Eq a, Eq i) => Eq (SparseSet i a) Source # 
Instance details

Defined in Data.SparseSet

Methods

(==) :: SparseSet i a -> SparseSet i a -> Bool #

(/=) :: SparseSet i a -> SparseSet i a -> Bool #

type Rep (SparseSet i a) Source # 
Instance details

Defined in Data.SparseSet

type Rep (SparseSet i a) = D1 ('MetaData "SparseSet" "Data.SparseSet" "sparse-set-0.3.0-9e4aezLoPlHECzYnIPXBuf" 'False) (C1 ('MetaCons "SparseSet" 'PrefixI 'True) (S1 ('MetaSel ('Just "dense") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector a)) :*: S1 ('MetaSel ('Just "sparse") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SparseVector i))))

Construction

Operations

insert :: Integral i => i -> a -> SparseSet i a -> SparseSet i a Source #

lookup :: Integral i => SparseSet i a -> i -> Maybe a Source #

delete :: Integral i => i -> SparseSet i a -> SparseSet i a Source #

Intersection

intersectionWith :: Integral i => (a -> b -> c) -> SparseSet i a -> SparseSet i b -> SparseSet i c Source #

intersectionVec :: Integral i => SparseSet i a -> SparseSet i b -> Vector a Source #

Conversion

toList :: Integral i => SparseSet i a -> [Maybe a] Source #

freeze :: PrimMonad m => MSparseSet (PrimState m) i a -> m (SparseSet i a) Source #

Freeze a MSparseSet into a SparseSet.

thaw :: PrimMonad m => SparseSet i a -> m (MSparseSet (PrimState m) i a) Source #

Unfreeze a SparseSet into a MSparseSet.