A GHC.Generics based entity component system.

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD-3-Clause licensed by Sandy Maguire
Maintained by

Ecstasy is an entity-component system for Haskell. It's inspired by apecs, but makes the design decision to focus on being idiomatic rather than being fast. Maybe. I haven't actually benchmarked it.

We achieve being idiomatic by using GHC.Generics and tricky type families to derive performant data stores given only a record of the desired components.


Revision history for ecstasy – 2018-05-15

  • Added the ‘surgery’ function to introduce temporary effects.
  • Significant performance improvements due to constructing monadic generic functions via ‘Codensity’. – 2018-05-10

  • Also export ‘StorageType’. – 2018-05-10

  • Renamed ‘get*’ to ‘query*’.
  • Renamed ‘newEntity’ to ‘createEntity’.
  • Renamed ‘defEntity’ to ‘newEntity’.
  • Renamed ‘defEntity’’ to ‘unchanged’.
  • Renamed ‘defWorld’ to ‘defStorage’.
  • Significant performance improvements.
  • Added a ‘Virtual’ component type, allowing for easy integration with systems that own their own data. Getting and setting on ‘Virtual’ components dispatch as actions in the underlying monad stack.
  • Added proper type wrappers around ‘SystemT’ and ‘QueryT’ so they don’t eat up valuable mtl instances.
  • Removed the ‘Ent’ parameter from the ‘efor’ callback, since this can now be gotten in any ‘QueryT’ context via ‘queryEnt’.
  • Parameterized ‘emap’ and ‘efor’ by an ‘EntityTarget’, which allows for calling these functions over specific groups of entities.
  • Added ‘eover’: a combination of ‘emap’ and ‘efor’. – 2018-02-18

  • Added ‘deleteEntity’ (function) and ‘delEntity’ (QueryT setter). – 2018-02-14

  • Added ‘yieldSystemT’ for resuming a ‘SystemT’ computation later.
  • Bumped the upper bound on ‘base’ to 5 (thanks to nek0). – 2017-12-27

  • First version. Released on an unsuspecting world.