Skip to content

Add explMemberSet method to ExplMembers typeclass#144

Merged
dpwiz merged 7 commits intojonascarpay:masterfrom
dpwiz:member-set
Mar 10, 2026
Merged

Add explMemberSet method to ExplMembers typeclass#144
dpwiz merged 7 commits intojonascarpay:masterfrom
dpwiz:member-set

Conversation

@dpwiz
Copy link
Collaborator

@dpwiz dpwiz commented Mar 6, 2026

This allows to write this little thingy to get every active entity id:

worldEntityIds :: System WorldEnumerable S.IntSet
worldEntityIds = do
  s :: Storage WorldEnumerableEnumerable <- getStore
  explMemberSet s

In theory this should enable This enables world dumps (e.g. by hunting for Serialiase instances) and introspection for debugging.


EitherStore now can have ExplMembers with union over its parts (instead of intersection like the rest).

Apecs.TH exports more utilities to derive collections of instances semi-automatically.

  • makeInstanceTuples
  • makeInstanceEithers
  • makeInstanceFold
    • mkTupleT
    • mkEitherT

The new Either machinery is used to derive WorldEnumerable type alias that looks like Either Postion (Either Velocity (Either ...)).

dpwiz and others added 4 commits March 6, 2026 21:58
- Introduced `explMemberSet` with a default implementation in `ExplMembers`.
- Provided explicit implementations for `IntMap`-based stores `Map`, `Unique` using `keysSet`.
- Provided implementations for `EitherStore` to compute `union` of constituent member sets.
- Included `explMemberSet` overrides for short circuits where possible such as `HeadStore` and `ChildListStore`.
- Modified `apecs-stm` and `apecs-physics` to support `explMemberSet`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…#4)

- Added `mkEitherT` to generate nested `Either` types.
- Generalized `makeInstanceTuples` into `makeInstanceFold` which takes a type-folding function.
- Reimplemented `makeInstanceTuples` using `makeInstanceFold` and `mkTupleT`.
- Implemented `makeInstanceEithers` using `makeInstanceFold` and `mkEitherT`.
- Exported the newly created functions (`makeInstanceFold`, `makeInstanceEithers`, `mkTupleT`, `mkEitherT`) from `Apecs.TH`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@dpwiz dpwiz requested a review from jonascarpay March 9, 2026 00:07
Copy link
Owner

@jonascarpay jonascarpay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@dpwiz dpwiz merged commit ad05d3a into jonascarpay:master Mar 10, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants