Skip to content

Add Apecs.Experimental.Reload module for GHCi world persistence#148

Open
dpwiz wants to merge 1 commit into
masterfrom
experimental-reload
Open

Add Apecs.Experimental.Reload module for GHCi world persistence#148
dpwiz wants to merge 1 commit into
masterfrom
experimental-reload

Conversation

@dpwiz
Copy link
Copy Markdown
Collaborator

@dpwiz dpwiz commented Apr 1, 2026

Uses foreign-store to persist world state across GHCi reloads, avoiding the need to reinitialize and repopulate worlds during interactive development.

Live on shmup (the world, persisting gloss is its own story...)

ghci> runReloadable initWorld $ collect $ \(Player, Position p) -> Just p
[V2 2.0 2.0]
ghci> :reload
Ok, one module loaded.
ghci> runReloadable initWorld $ collect $ \(Player, Position p) -> Just p
[V2 2.0 2.0]
ghci> runReloadable initWorld $ newEntity (Target, Position 10)
Entity {unEntity = 4}
ghci> :reload
Ok, one module loaded.
ghci> runReloadable initWorld $ collect $ \(e :: Either Player Target, Position p) -> Just (e, p)
[(Right Target,V2 10.0 10.0),(Left Player,V2 2.0 2.0)]

@dpwiz dpwiz force-pushed the experimental-reload branch from 768b375 to fcec806 Compare April 2, 2026 22:45
@dpwiz dpwiz marked this pull request as ready for review April 2, 2026 22:45
@dpwiz dpwiz force-pushed the experimental-reload branch from fcec806 to fe9c5c0 Compare April 3, 2026 22:49
Uses foreign-store to persist world state across GHCi reloads,
avoiding the need to reinitialize and repopulate worlds during
interactive development.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dpwiz dpwiz force-pushed the experimental-reload branch from fe9c5c0 to b91c9d4 Compare May 1, 2026 23:22
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.

1 participant