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.TH

  • 12 values
  • Packageapecs-0.10.1
  • Exports12
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTH.hs
valuemakeWorld :: String -> [Name] -> Q [Dec]
#

The typical way to create a world record, associated Has instances, and initialization function.

makeWorld "MyWorld" [''Component1, ''Component2, ...]

turns into

data MyWorld = MyWorld Component1 Component2 ... EntityCounter
instance MyWorld `Has` Component1 where ...
instance MyWorld `Has` Component2 where ...
...
instance MyWorld `Has` EntityCounter where ...

initMyWorld :: IO MyWorld
initMyWorld = MyWorld <$> initStore <*> initStore <*> ... <*> initStore
valuehasStoreInstance
  1. :: [String]

    Skip those stores

  2. -> Name

    Class name (ExplThis)

  3. -> Type

    m var like ConT ''IO

  4. -> Name

    component type name

  5. -> Q Bool
#

Resolve storage type and check for an instance like ExplThis m (Map Position)

Can be used to pre-filter component lists for makeInstanceFold.