aztecs-hs/aztecs

A modular game engine and ECS for Haskell

Haskell

157

715 commits

updated Jan 30, 2026

See the code

README

Aztecs

License Package CI status

A modular game engine and ECS for Haskell. An ECS is a modern approach to organizing your application state as a database, providing patterns for data-oriented design and parallel processing.

Examples

Features

  • Type-safe: Queries and systems use fully type-checked access with compile-time gurantees
  • High-performance: Components are stored by their unique sets in archetypes
  • Reactive: Component lifecycle hooks enable change-detection and event-based state management
  • Modular design: Aztecs can be extended for a variety of use cases
newtype Position = Position Int deriving (Show)

instance (Monad m) => Component m Position

newtype Velocity = Velocity Int deriving (Show)

instance (Monad m) => Component m Velocity

move :: (Monad m) => Query m Position
move = queryMapWith go query
  where
    go (Velocity v) (Position p) = Position $ p + v

app :: Access IO ()
app = do
  spawn_ $ bundle (Position 0) <> bundle (Velocity 1)
  positions <- system $ runQuery move
  liftIO $ print positions

main :: IO ()
main = runAccess_ app

Packages

Prior art

Aztecs' approach to archetypical ECS is inspired by Bevy and Flecs.

A fantastic lower-level (but higher-performance) Haskell ECS Apecs

ecs
game-engine
haskell

Contributors

matthunz

714 commits

stepcut

1 commits

aztecs-hs/aztecs

A modular game engine and ECS for Haskell

Haskell

157

715 commits

updated Jan 30, 2026

See the code

README

Aztecs

License Package CI status

A modular game engine and ECS for Haskell. An ECS is a modern approach to organizing your application state as a database, providing patterns for data-oriented design and parallel processing.

Examples

Features

  • Type-safe: Queries and systems use fully type-checked access with compile-time gurantees
  • High-performance: Components are stored by their unique sets in archetypes
  • Reactive: Component lifecycle hooks enable change-detection and event-based state management
  • Modular design: Aztecs can be extended for a variety of use cases
newtype Position = Position Int deriving (Show)

instance (Monad m) => Component m Position

newtype Velocity = Velocity Int deriving (Show)

instance (Monad m) => Component m Velocity

move :: (Monad m) => Query m Position
move = queryMapWith go query
  where
    go (Velocity v) (Position p) = Position $ p + v

app :: Access IO ()
app = do
  spawn_ $ bundle (Position 0) <> bundle (Velocity 1)
  positions <- system $ runQuery move
  liftIO $ print positions

main :: IO ()
main = runAccess_ app

Packages

Prior art

Aztecs' approach to archetypical ECS is inspired by Bevy and Flecs.

A fantastic lower-level (but higher-performance) Haskell ECS Apecs

ecs
game-engine
haskell

Contributors

matthunz

714 commits

stepcut

1 commits

Languages

Haskell

100.0%