HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleapecs-0.10.1Haskell2010

Apecs.Experimental.Reload

This module is experimental, and its API might change between point releases. Use at your own risk.

Utilities for persisting an apecs world across GHCi reloads using foreign-store. This is intended for development workflows only — do not use in production.

Important: if you change your world's type (e.g. add or remove components), you must call resetWorld or restart GHCi. The foreign store is not type-safe across type changes.

Typical usage:

mainDev :: IO ()
mainDev = runReloadable initWorld someSystem
  • 1 type
  • 6 values
  • Packageapecs-0.10.1
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceReload.hs
valuerunReloadable :: IO w -> SystemT w IO a -> IO a
#

Retrieve or initialize a world, then run a system in it.

main = runReloadable initWorld $ do
  newEntity (Position 0, Velocity 1)
  cmap $ \(Position p, Velocity v) -> Position (p + v)
valuerunReloadableAt :: Word32 -> IO w -> SystemT w IO a -> IO a
#

Retrieve or initialize a world at a specified index, then run a system in it.

main = runReloadableAt 0 initWorld $ do
  newEntity (Position 0, Velocity 1)
  cmap $ \(Position p, Velocity v) -> Position (p + v)

Default foreign store index (0). Sufficient when only one world is used in a GHCi session. Use a different index if you need multiple independent worlds.

valuegetOrInitWorld :: Word32 -> IO w -> IO w
#

Look up a world in the foreign store at the given index. If one exists, return it. Otherwise, run the initialization action, persist the result, and return it.

valuestoreWorld :: Word32 -> w -> IO ()
#

Persist a world value at the given foreign store index, overwriting any previous value.

valueresetWorld :: Word32 -> IO w -> IO w
#

Discard any persisted world at the given index, initialize a fresh one, persist it, and return it.

newtypenewtype Store a
#

A hideously unsafe store. Only for use if you are suave.

Instances2Eq, Show
  • Eq (Store a)Defined in foreign-store-0.2.1 · Foreign.Store
  • Show (Store a)Defined in foreign-store-0.2.1 · Foreign.Store