aztecs-0.16.0: A modular game engine and Entity-Component-System (ECS) for Haskell.
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

Aztecs.ECS.World.Storage

Description

 
Synopsis

Documentation

class (Typeable s, Typeable a) => Storage a s where Source #

Component storage, containing zero or many components of the same type.

Methods

singleton :: a -> s Source #

Storage with a single component.

toAscVector :: s -> Vector a Source #

Vector of all components in the storage in ascending order.

fromAscVector :: Vector a -> s Source #

Convert a sorted vector of components (in ascending order) into a storage.

map :: (a -> a) -> s -> s Source #

Map a function over all components in the storage.

zipWith :: (i -> a -> a) -> Vector i -> s -> (Vector a, s) Source #

Map a function with some input over all components in the storage.

zipWithM :: Monad m => (i -> a -> m a) -> Vector i -> s -> m (Vector a, s) Source #

Map an applicative functor with some input over all components in the storage.

zipWith_ :: (i -> a -> a) -> Vector i -> s -> s Source #

Map a function with some input over all components in the storage.

zipWithAccum :: (i -> a -> (o, a)) -> Vector i -> s -> (Vector (o, a), s) Source #

Map a function with some input over all components, returning a tuple result and updated storage.

zipWithAccumM :: Monad m => (i -> a -> m (o, a)) -> Vector i -> s -> m (Vector (o, a), s) Source #

Map a monadic function with some input over all components, returning a tuple result and updated storage.

Instances

Instances details
Typeable a => Storage a (Vector a) Source # 
Instance details

Defined in Aztecs.ECS.World.Storage

Methods

singleton :: a -> Vector a Source #

toAscVector :: Vector a -> Vector a Source #

fromAscVector :: Vector a -> Vector a Source #

map :: (a -> a) -> Vector a -> Vector a Source #

zipWith :: (i -> a -> a) -> Vector i -> Vector a -> (Vector a, Vector a) Source #

zipWithM :: Monad m => (i -> a -> m a) -> Vector i -> Vector a -> m (Vector a, Vector a) Source #

zipWith_ :: (i -> a -> a) -> Vector i -> Vector a -> Vector a Source #

zipWithAccum :: (i -> a -> (o, a)) -> Vector i -> Vector a -> (Vector (o, a), Vector a) Source #

zipWithAccumM :: Monad m => (i -> a -> m (o, a)) -> Vector i -> Vector a -> m (Vector (o, a), Vector a) Source #