mischief-ecs
Safe HaskellNone
LanguageGHC2024

Mischief.ECS.Prelude

Synopsis

Documentation

class (Typeable c, IsExclusive (IsExclusiveRel c)) => Component c where Source #

The Component typeclass.

Minimal complete definition

Nothing

Associated Types

type IsExclusiveRel c :: Bool Source #

Methods

required :: Set DefaultComponentType Source #

List of components required by this one. All required components must be Default

Example

data A = A
instance Component A where
  required = require @(B, C)

data B = B Int deriving (Component, Generic, Default)

data C = C String deriving (Component)
instance Default C where
  def = C "Default String"

onAdd :: [Hook c] Source #

onSet :: [Hook c] Source #

onRemove :: [Hook c] Source #

onAddRel :: [HookRel c] Source #

onSetRel :: [HookRel c] Source #

onRemoveRel :: [HookRel c] Source #

Instances

Instances details
Component ScheduleLabel Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

Associated Types

type IsExclusiveRel ScheduleLabel 
Instance details

Defined in Mischief.ECS.App.Schedules

Component Schedules Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

Associated Types

type IsExclusiveRel Schedules 
Instance details

Defined in Mischief.ECS.App.Schedules

Component StartupSchedule Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

Associated Types

type IsExclusiveRel StartupSchedule 
Instance details

Defined in Mischief.ECS.App.Schedules

Component UpdateSchedule Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

Associated Types

type IsExclusiveRel UpdateSchedule 
Instance details

Defined in Mischief.ECS.App.Schedules

Component LastSystemTick Source # 
Instance details

Defined in Mischief.ECS.App.SystemDef

Associated Types

type IsExclusiveRel LastSystemTick 
Instance details

Defined in Mischief.ECS.App.SystemDef

Component SystemTick Source # 
Instance details

Defined in Mischief.ECS.App.SystemDef

Associated Types

type IsExclusiveRel SystemTick 
Instance details

Defined in Mischief.ECS.App.SystemDef

Component ScheduledIn Source # 
Instance details

Defined in Mischief.ECS.App.Systems

Associated Types

type IsExclusiveRel ScheduledIn 
Instance details

Defined in Mischief.ECS.App.Systems

Component SystemFunction Source # 
Instance details

Defined in Mischief.ECS.App.Systems

Associated Types

type IsExclusiveRel SystemFunction 
Instance details

Defined in Mischief.ECS.App.Systems

Component Systems Source # 
Instance details

Defined in Mischief.ECS.App.Systems

Associated Types

type IsExclusiveRel Systems 
Instance details

Defined in Mischief.ECS.App.Systems

Component ComponentArchetypes Source # 
Instance details

Defined in Mischief.ECS.Components

Associated Types

type IsExclusiveRel ComponentArchetypes 
Instance details

Defined in Mischief.ECS.Components

Component ComponentPairs Source # 
Instance details

Defined in Mischief.ECS.Components

Associated Types

type IsExclusiveRel ComponentPairs 
Instance details

Defined in Mischief.ECS.Components

Component ComponentType Source # 
Instance details

Defined in Mischief.ECS.Components

Associated Types

type IsExclusiveRel ComponentType 
Instance details

Defined in Mischief.ECS.Components

Component DefaultValue Source # 
Instance details

Defined in Mischief.ECS.Components

Associated Types

type IsExclusiveRel DefaultValue 
Instance details

Defined in Mischief.ECS.Components

Component IsExclusiveRelationship Source # 
Instance details

Defined in Mischief.ECS.Components

Component RequiredBy Source # 
Instance details

Defined in Mischief.ECS.Components

Associated Types

type IsExclusiveRel RequiredBy 
Instance details

Defined in Mischief.ECS.Components

Component Requires Source # 
Instance details

Defined in Mischief.ECS.Components

Associated Types

type IsExclusiveRel Requires 
Instance details

Defined in Mischief.ECS.Components

Component Name Source # 
Instance details

Defined in Mischief.ECS.Components.Common

Associated Types

type IsExclusiveRel Name 
Instance details

Defined in Mischief.ECS.Components.Common

Component ComponentAddHooks Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

Component ComponentAddHooksRel Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

Component ComponentRemoveHooks Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

Component ComponentRemoveHooksRel Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

Component ComponentSetHooks Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

Component ComponentSetHooksRel Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

Component ObserverOrder Source # 
Instance details

Defined in Mischief.ECS.Observer

Associated Types

type IsExclusiveRel ObserverOrder 
Instance details

Defined in Mischief.ECS.Observer

Component ChildOf Source # 
Instance details

Defined in Mischief.ECS.Relationships.ChildOf

Associated Types

type IsExclusiveRel ChildOf 
Instance details

Defined in Mischief.ECS.Relationships.ChildOf

Component Before Source # 
Instance details

Defined in Mischief.ECS.Relationships.Order

Associated Types

type IsExclusiveRel Before 
Instance details

Defined in Mischief.ECS.Relationships.Order

Component Visited Source # 
Instance details

Defined in Mischief.ECS.Relationships.Order

Associated Types

type IsExclusiveRel Visited 
Instance details

Defined in Mischief.ECS.Relationships.Order

Component VirtualTime Source # 
Instance details

Defined in Mischief.ECS.Time

Associated Types

type IsExclusiveRel VirtualTime 
Instance details

Defined in Mischief.ECS.Time

Typeable e => Component (Observer e) Source # 
Instance details

Defined in Mischief.ECS.Observer

Associated Types

type IsExclusiveRel (Observer e) 
Instance details

Defined in Mischief.ECS.Observer

(Typeable e, Typeable k) => Component (EventProxy e) Source # 
Instance details

Defined in Mischief.ECS.Observer

Associated Types

type IsExclusiveRel (EventProxy e) 
Instance details

Defined in Mischief.ECS.Observer

(Typeable a, Typeable b, Typeable k1, Typeable k2) => Component (TestG a b) Source # 
Instance details

Defined in Mischief.ECS.World.Query.TH.QD

Associated Types

type IsExclusiveRel (TestG a b) 
Instance details

Defined in Mischief.ECS.World.Query.TH.QD

type IsExclusiveRel (TestG a b) = 'False

data From c Source #

Constructors

From 

Fields

Instances

Instances details
Functor From Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

fmap :: (a -> b) -> From a -> From b #

(<$) :: a -> From b -> From a #

(Component c, Queryable q out) => RelQuery 'False (MR c (Q q)) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'False (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'False (R c (Q q)) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe [From out]) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'False (R c (Q' q (QueryFilter 'ArchetypeFilter))) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (MR c (Q q)) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'True (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (R c (Q q)) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe (From out)) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'True (R c (Q' q (QueryFilter 'ArchetypeFilter))) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Show c => Show (From c) Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

showsPrec :: Int -> From c -> ShowS #

show :: From c -> String #

showList :: [From c] -> ShowS #

Eq c => Eq (From c) Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

(==) :: From c -> From c -> Bool #

(/=) :: From c -> From c -> Bool #

Collectable c (BundleData ErasedComponent) => EraseIntoStorage (From c) (BundleData ErasedComponent) Source # 
Instance details

Defined in Mischief.ECS.Components

Collectable c (BundleData ErasedComponentEq) => EraseIntoStorage (From c) (BundleData ErasedComponentEq) Source # 
Instance details

Defined in Mischief.ECS.Components

type family IsExclusiveRel c :: Bool Source #

Instances

Instances details
type IsExclusiveRel ScheduleLabel Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

type IsExclusiveRel Schedules Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

type IsExclusiveRel StartupSchedule Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

type IsExclusiveRel UpdateSchedule Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

type IsExclusiveRel LastSystemTick Source # 
Instance details

Defined in Mischief.ECS.App.SystemDef

type IsExclusiveRel SystemTick Source # 
Instance details

Defined in Mischief.ECS.App.SystemDef

type IsExclusiveRel ScheduledIn Source # 
Instance details

Defined in Mischief.ECS.App.Systems

type IsExclusiveRel SystemFunction Source # 
Instance details

Defined in Mischief.ECS.App.Systems

type IsExclusiveRel Systems Source # 
Instance details

Defined in Mischief.ECS.App.Systems

type IsExclusiveRel ComponentArchetypes Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel ComponentPairs Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel ComponentType Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel DefaultValue Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel IsExclusiveRelationship Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel RequiredBy Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel Requires Source # 
Instance details

Defined in Mischief.ECS.Components

type IsExclusiveRel Name Source # 
Instance details

Defined in Mischief.ECS.Components.Common

type IsExclusiveRel ComponentAddHooks Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

type IsExclusiveRel ComponentAddHooksRel Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

type IsExclusiveRel ComponentRemoveHooks Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

type IsExclusiveRel ComponentRemoveHooksRel Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

type IsExclusiveRel ComponentSetHooks Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

type IsExclusiveRel ComponentSetHooksRel Source # 
Instance details

Defined in Mischief.ECS.Components.Spawn

type IsExclusiveRel ObserverOrder Source # 
Instance details

Defined in Mischief.ECS.Observer

type IsExclusiveRel ChildOf Source # 
Instance details

Defined in Mischief.ECS.Relationships.ChildOf

type IsExclusiveRel Before Source # 
Instance details

Defined in Mischief.ECS.Relationships.Order

type IsExclusiveRel Visited Source # 
Instance details

Defined in Mischief.ECS.Relationships.Order

type IsExclusiveRel VirtualTime Source # 
Instance details

Defined in Mischief.ECS.Time

type IsExclusiveRel (Observer e) Source # 
Instance details

Defined in Mischief.ECS.Observer

type IsExclusiveRel (EventProxy e) Source # 
Instance details

Defined in Mischief.ECS.Observer

type IsExclusiveRel (TestG a b) Source # 
Instance details

Defined in Mischief.ECS.World.Query.TH.QD

type IsExclusiveRel (TestG a b) = 'False

data Rel c Source #

Type used for querying and inserting relationships.

Constructors

Rel 

Fields

Instances

Instances details
Functor Rel Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

fmap :: (a -> b) -> Rel a -> Rel b #

(<$) :: a -> Rel b -> Rel a #

Component c => RelQuery 'False (MR c Any) (Maybe [Rel c]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'False (R c Any) [Rel c] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'True (MR c Any) (Maybe (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'True (R c Any) (Rel c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Show c => Show (Rel c) Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

showsPrec :: Int -> Rel c -> ShowS #

show :: Rel c -> String #

showList :: [Rel c] -> ShowS #

Eq c => Eq (Rel c) Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

(==) :: Rel c -> Rel c -> Bool #

(/=) :: Rel c -> Rel c -> Bool #

Component c => EraseIntoStorage (Rel c) (BundleData ErasedComponent) Source # 
Instance details

Defined in Mischief.ECS.Components

(Component c, Eq c) => EraseIntoStorage (Rel c) (BundleData ErasedComponentEq) Source # 
Instance details

Defined in Mischief.ECS.Components

Component c => Queryable (MR c Entity) (Maybe (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => Queryable (R c Entity) (Rel c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype Res c Source #

Constructors

Res 

Fields

Instances

Instances details
Functor Res Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

fmap :: (a -> b) -> Res a -> Res b #

(<$) :: a -> Res b -> Res a #

Show c => Show (Res c) Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

showsPrec :: Int -> Res c -> ShowS #

show :: Res c -> String #

showList :: [Res c] -> ShowS #

Eq c => Eq (Res c) Source # 
Instance details

Defined in Mischief.ECS.Components

Methods

(==) :: Res c -> Res c -> Bool #

(/=) :: Res c -> Res c -> Bool #

Component c => EraseIntoStorage (Res c) (BundleData ErasedComponent) Source # 
Instance details

Defined in Mischief.ECS.Components

(Component c, Eq c) => EraseIntoStorage (Res c) (BundleData ErasedComponentEq) Source # 
Instance details

Defined in Mischief.ECS.Components

Component c => Queryable (MRes c) (Maybe (Res c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => Queryable (c -> Res c) (Res c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: (c -> Res c) -> World -> Entity -> IO (Maybe (Res c)) Source #

runQueryInternal :: (c -> Res c) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Res c)] Source #

queryTypes :: (c -> Res c) -> Set (TypeRep, TypeQuery) Source #

require :: forall {k} (b :: k). RequiredBundle b => Set DefaultComponentType Source #

data Entity Source #

UNLIFTED

Points to an unique entity. The first Word# is an id, the second is a generation.

It is guaranteed that there can't be two alive entities with the same id.

Instances

Instances details
Show Entity Source # 
Instance details

Defined in Mischief.ECS.EntityDef

Eq Entity Source # 
Instance details

Defined in Mischief.ECS.EntityDef

Methods

(==) :: Entity -> Entity -> Bool #

(/=) :: Entity -> Entity -> Bool #

Ord Entity Source # 
Instance details

Defined in Mischief.ECS.EntityDef

Queryable E Entity Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

ListToOutgoing (Maybe Entity) Source # 
Instance details

Defined in Mischief.ECS.Relationships.Graph

ListToOutgoing [Entity] Source # 
Instance details

Defined in Mischief.ECS.Relationships.Graph

Component c => ToFilterComponent (R c Entity) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Component c => Queryable (HasR c Entity) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => Queryable (MR c Entity) (Maybe (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => Queryable (R c Entity) (Rel c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

mkGet :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> Query m out Source #

mkGet' :: forall qd out (m :: Type -> Type). Queryable qd out => Entity -> qd -> QueryFilter 'ArchetypeFilter -> Query m out Source #

mkQuery :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> Query m out Source #

mkQuery' :: forall qd out (m :: Type -> Type). Queryable qd out => qd -> QueryFilter 'ArchetypeFilter -> Query m out Source #

query :: MonadSystem w m => Query m out -> m [out] Source #

query_ :: MonadSystem w m => Query m out -> m () Source #

single :: MonadSystem w m => Query m out -> m (Maybe out) Source #

data Query (m :: Type -> Type) a Source #

Instances

Instances details
MonadSystem w m => Applicative (Query m) Source # 
Instance details

Defined in Mischief.ECS.World.Query

Methods

pure :: a -> Query m a #

(<*>) :: Query m (a -> b) -> Query m a -> Query m b #

liftA2 :: (a -> b -> c) -> Query m a -> Query m b -> Query m c #

(*>) :: Query m a -> Query m b -> Query m b #

(<*) :: Query m a -> Query m b -> Query m a #

MonadSystem w m => Functor (Query m) Source # 
Instance details

Defined in Mischief.ECS.World.Query

Methods

fmap :: (a -> b) -> Query m a -> Query m b #

(<$) :: a -> Query m b -> Query m a #

MonadSystem w m => Monad (Query m) Source # 
Instance details

Defined in Mischief.ECS.World.Query

Methods

(>>=) :: Query m a -> (a -> Query m b) -> Query m b #

(>>) :: Query m a -> Query m b -> Query m b #

return :: a -> Query m a #

data QueryFilter (f :: FilterType) where Source #

Constructors

NoFilter :: forall (f :: FilterType). QueryFilter f 
With :: forall a (f :: FilterType). ToFilterComponent a => a -> QueryFilter f 
Without :: forall a (f :: FilterType). ToFilterComponent a => a -> QueryFilter f 
Changed :: forall a. ToFilterComponent a => a -> QueryFilter 'EntityFilter 
Added :: forall a. ToFilterComponent a => a -> QueryFilter 'EntityFilter 
Not :: forall (f :: FilterType). QueryFilter f -> QueryFilter f 
And :: forall (f :: FilterType). QueryFilter f -> QueryFilter f -> QueryFilter f 
Or :: forall (f :: FilterType). QueryFilter f -> QueryFilter f -> QueryFilter f 

Instances

Instances details
(Component c, Queryable q out) => RelQuery 'False (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'False (R c (Q' q (QueryFilter 'ArchetypeFilter))) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (R c (Q' q (QueryFilter 'ArchetypeFilter))) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Semigroup (QueryFilter f) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

(Component c, Queryable q out) => Queryable (HasR c (Q' q (QueryFilter 'ArchetypeFilter))) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data Any Source #

Wildcard used when querying for relationships to indicate that you're querying for relationships with any target.

In the case of exclusive relationships, Any returns a single relationship rather than a list of relationships.

Constructors

Any 

Instances

Instances details
Component c => RelQuery 'False (MR c Any) (Maybe [Rel c]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'False (R c Any) [Rel c] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'True (MR c Any) (Maybe (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'True (R c Any) (Rel c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => ToFilterComponent (R c Any) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Component c => Queryable (HasR c Any) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (MR c Any) out => Queryable (MR c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (R c Any) out => Queryable (R c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data C (a :: k) Source #

Used to query for a component or to remove a component. Forces queries to only include entities which have the component.

Example

Querying:

x <- query (C @Name)

Removing:

remove (C @Name)

Quasi Notation

None, you just write the component name directly. For instance:

x <- [q|Name|]

Constructors

C 

Instances

Instances details
Component c => ToFilterComponent (C c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Component c => Queryable (C c) c Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data E Source #

Used to query for the Entity.

Example

x <- query E

Quasi Notation

  • Entity
  • entity
  • E
  • e

For instance:

x <- [q|Entity|]

Constructors

E 

Instances

Instances details
Queryable E Entity Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data Has (a :: k) Source #

Used in queries to return a Bool which indicates whether a component exists on the entity or not.

Example

x <- query (Has @Name)

Quasi Notation

  • Has
  • has
  • H
  • h

For instance:

x <- [q|Has Name|]

Constructors

Has 

Instances

Instances details
Component c => Queryable (Has c) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype HasR (a :: k) b Source #

Exactly like R, except that it returns a Bool depending on whether the entity has such a relationship or not.

Example

x <- query (HasR @Likes Any)

Quasi Notation

  • Has
  • has
  • H
  • h

For instance:

x <- [q|Has Likes -> *|]

Constructors

HasR b 

Instances

Instances details
Component c => Queryable (HasR c Entity) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => Queryable (HasR c Any) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => Queryable (HasR c (Q' q (QueryFilter 'ArchetypeFilter))) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

data M (a :: k) Source #

Used to query for a component that an entity may or may not have.

Example

x <- query (M @Name)

Quasi Notation

  • Maybe
  • maybe
  • M
  • m

For instance:

x <- [q|Maybe Name|]

Constructors

M 

Instances

Instances details
Component c => Queryable (M c) (Maybe c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype MR (a :: k) b Source #

Exactly like R, except that it wraps the result in a Maybe, also including entities that don't have such a relationship.

Example

x <- query (MR @Likes Any)

Quasi Notation

  • Maybe
  • maybe
  • M
  • m

For instance:

x <- [q|Maybe Likes -> *|]

Constructors

MR b 

Instances

Instances details
Component c => RelQuery 'False (MR c Any) (Maybe [Rel c]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'False (MR c (Q q)) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'False (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'True (MR c Any) (Maybe (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (MR c (Q q)) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'True (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (MR c Any) out => Queryable (MR c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

RelQuery (IsExclusiveRel c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => Queryable (MR c Entity) (Maybe (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype Q a Source #

Used when writing transitive queries. See R.

Constructors

Q a 

Instances

Instances details
(Component c, Queryable q out) => RelQuery 'False (MR c (Q q)) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe [From out])) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [From out])] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'False (R c (Q q)) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe [From out]) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'True (MR c (Q q)) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe (From out))) Source #

relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (From out))] Source #

relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'True (R c (Q q)) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe (From out)) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (MR c (Q q)) out => Queryable (MR c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) Source #

RelQuery (IsExclusiveRel c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

data Q' a b Source #

Used when writing transitive queries with filters. See R.

Constructors

Q' a b 

Instances

Instances details
(Component c, Queryable q out) => RelQuery 'False (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe [From out]) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'False (R c (Q' q (QueryFilter 'ArchetypeFilter))) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (MR c (Q' q (QueryFilter 'ArchetypeFilter))) (Maybe (From out)) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (R c (Q' q (QueryFilter 'ArchetypeFilter))) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => Queryable (HasR c (Q' q (QueryFilter 'ArchetypeFilter))) Bool Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (MR c (Q' q f)) out => Queryable (MR c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: MR c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: MR c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: MR c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

RelQuery (IsExclusiveRel c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

newtype R (a :: k) b Source #

Used to query for a relationships. Can be used in three different ways:

1. R c e

Queries for a relationship with a specific target. Forces queries to only include entities which have such a relationship.

Example

x <- query (R @Likes alice)
x :: [Result (Rel Likes)]

Quasi Notation

It is written with an arrow like so:

x <- [q|Likes -> alice|]

2. R c Any

Queries for all relationships with any target. Forces queries to only include entities which have at least one such relationship.

Example

x <- query (R @Likes Any)
x :: [[Result (Rel Likes)]]

Quasi Notation

x <- [q|Likes -> *|]

3. R c q

Runs a transitive query on the targets of all such relationships. q can either be Q d or Q' d f, depending if you want to also run a filter or not.

Similar to the previous case, it will limit the query to only entities which have such a relationship with at least one entity which matches the transitive query.

Example

x <- query (R @Likes (Q (C @Name))
x <- query (R @Likes (Q' (C @Name) (With (C @Enemy))))
x :: [[Result Name]]

Quasi Notation

You just write the given query in the () following the arrow. / can be used to give it a filter.

For instance:

x <- [q|Likes -> (Name)|]
x <- [q|Likes -> (Name / With Enemy)|]

Constructors

R b 

Instances

Instances details
Component c => RelQuery 'False (R c Any) [Rel c] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'False (R c (Q q)) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe [From out]) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [From out])] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'False (R c (Q' q (QueryFilter 'ArchetypeFilter))) [From out] Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => RelQuery 'True (R c Any) (Rel c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

(Component c, Queryable q out) => RelQuery 'True (R c (Q q)) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe (From out)) Source #

relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, From out)] Source #

relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

(Component c, Queryable q out) => RelQuery 'True (R c (Q' q (QueryFilter 'ArchetypeFilter))) (From out) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Component c => ToFilterComponent (R c Entity) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

Component c => ToFilterComponent (R c Any) Source # 
Instance details

Defined in Mischief.ECS.World.Query.QueryFilter

RelQuery (IsExclusiveRel c) (R c Any) out => Queryable (R c Any) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

RelQuery (IsExclusiveRel c) (R c (Q q)) out => Queryable (R c (Q q)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) Source #

RelQuery (IsExclusiveRel c) (R c (Q' q f)) out => Queryable (R c (Q' q f)) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R c (Q' q f) -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R c (Q' q f) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R c (Q' q f) -> Set (TypeRep, TypeQuery) Source #

Component c => Queryable (R c Entity) (Rel c) Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

newtype R' (a :: k) b Source #

Constructors

R' b 

Instances

Instances details
RelQuery 'False (R c e) out => Queryable (R' c e) out Source # 
Instance details

Defined in Mischief.ECS.World.Query.Queryable

Methods

runQueryEntity :: R' c e -> World -> Entity -> IO (Maybe out) Source #

runQueryInternal :: R' c e -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] Source #

queryTypes :: R' c e -> Set (TypeRep, TypeQuery) Source #

insert :: HasCallStack => forall b. Bundle b => b -> Entity -> System () Source #

Insert a bundle of components on an Entity.

If the entity already contains these components, their values will be updated in-place instead of causing an archetype change.

insertNew :: Bundle b => b -> Entity -> System () Source #

Insert a bundle of components on an Entity.

Only the components that the entity doesn't already have will be inserted, and the rest ignored.

remove :: Collectable c ToRemove => c -> Entity -> System () Source #

despawn :: Entity -> System () Source #

Despawn an entity. This will trigger the OnRemove events and hooks on all its components.

spawn :: (HasCallStack, Bundle b) => b -> System Entity Source #

Spawn an entity given a bundle of components.

spawnDefer :: Bundle b => b -> ParSystem Entity Source #

Spawn an entity given a bundle of components, inside a ParSystem.

This will immediately reserve and return an Entity index which can be used, while defering the actual spawn.

class Typeable e => Event e Source #

Event typeclass.

Instances

Instances details
(Typeable c, Typeable k) => Event (OnAdd c) Source # 
Instance details

Defined in Mischief.ECS.Events

(Typeable c, Typeable k) => Event (OnAddRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

(Typeable c, Typeable k) => Event (OnRemove c) Source # 
Instance details

Defined in Mischief.ECS.Events

(Typeable c, Typeable k) => Event (OnRemoveRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

(Typeable c, Typeable k) => Event (OnSet c) Source # 
Instance details

Defined in Mischief.ECS.Events

(Typeable c, Typeable k) => Event (OnSetRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

data System a Source #

A System is a monad that mutates the World.

It can be added to a certain schedule and ordered with other systems. It also offers IO access via liftIO.

Read the tutorial on systems for more details.

Instances

Instances details
Applicative System Source # 
Instance details

Defined in Mischief.ECS.World

Methods

pure :: a -> System a #

(<*>) :: System (a -> b) -> System a -> System b #

liftA2 :: (a -> b -> c) -> System a -> System b -> System c #

(*>) :: System a -> System b -> System b #

(<*) :: System a -> System b -> System a #

Functor System Source # 
Instance details

Defined in Mischief.ECS.World

Methods

fmap :: (a -> b) -> System a -> System b #

(<$) :: a -> System b -> System a #

Monad System Source # 
Instance details

Defined in Mischief.ECS.World

Methods

(>>=) :: System a -> (a -> System b) -> System b #

(>>) :: System a -> System b -> System b #

return :: a -> System a #

MonadFail System Source # 
Instance details

Defined in Mischief.ECS.World

Methods

fail :: String -> System a #

MonadIO System Source # 
Instance details

Defined in Mischief.ECS.World

Methods

liftIO :: IO a -> System a #

Defer System Source # 
Instance details

Defined in Mischief.ECS.World.Defer

Methods

defer :: System a -> System () Source #

PrimMonad System Source # 
Instance details

Defined in Mischief.ECS.World

Associated Types

type PrimState System 
Instance details

Defined in Mischief.ECS.World

Methods

primitive :: (State# (PrimState System) -> (# State# (PrimState System), a #)) -> System a #

EraseIntoStorage (System ()) Systems Source # 
Instance details

Defined in Mischief.ECS.Systems

Methods

erase :: System () -> Systems Source #

EraseIntoStorage (System ()) [System ()] Source # 
Instance details

Defined in Mischief.ECS.World

Methods

erase :: System () -> [System ()] Source #

type PrimState System Source # 
Instance details

Defined in Mischief.ECS.World

data TimePlugin Source #

Instances

Instances details
Plugin TimePlugin Source # 
Instance details

Defined in Mischief.ECS.Time

delay :: MonadSystem w m => Int -> System () -> m () Source #

runAfter :: MonadSystem w m => IO a -> (a -> System ()) -> m () Source #

defer :: Defer m => System a -> m () Source #

addPlugin :: Plugin p => App -> IO () Source #

runApp :: App -> IO () Source #

class Typeable p => Plugin p where Source #

Minimal complete definition

Nothing

Instances

Instances details
Plugin TimePlugin Source # 
Instance details

Defined in Mischief.ECS.Time

data PostStartup Source #

Instances

Instances details
Schedule PostStartup Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

data PostUpdate Source #

Instances

Instances details
Schedule PostUpdate Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

data PreStartup Source #

Instances

Instances details
Schedule PreStartup Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

data PreUpdate Source #

Instances

Instances details
Schedule PreUpdate Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

data Startup Source #

Instances

Instances details
Show Startup Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

Schedule Startup Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

data Update Source #

Instances

Instances details
Show Update Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

Schedule Update Source # 
Instance details

Defined in Mischief.ECS.App.Schedules

order :: forall {k} (sc :: k) a b. (Schedule sc, ToSystems a, ToSystems b) => (a, b) -> System () Source #

schedule :: forall {k} (sc :: k). Schedule sc => SystemConfig -> System () Source #

unschedule :: forall {k} (sc :: k) a. (Schedule sc, ToSystems a) => a -> System () Source #

trigger :: Event e => e -> System () Source #

newtype OnAdd (c :: k) Source #

Constructors

OnAdd 

Fields

Instances

Instances details
Show (OnAdd c) Source # 
Instance details

Defined in Mischief.ECS.Events

Methods

showsPrec :: Int -> OnAdd c -> ShowS #

show :: OnAdd c -> String #

showList :: [OnAdd c] -> ShowS #

(Typeable c, Typeable k) => Event (OnAdd c) Source # 
Instance details

Defined in Mischief.ECS.Events

data OnAddRel (c :: k) Source #

Constructors

OnAddRel 

Fields

Instances

Instances details
Show (OnAddRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

Methods

showsPrec :: Int -> OnAddRel c -> ShowS #

show :: OnAddRel c -> String #

showList :: [OnAddRel c] -> ShowS #

(Typeable c, Typeable k) => Event (OnAddRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

newtype OnRemove (c :: k) Source #

Constructors

OnRemove 

Fields

Instances

Instances details
Show (OnRemove c) Source # 
Instance details

Defined in Mischief.ECS.Events

Methods

showsPrec :: Int -> OnRemove c -> ShowS #

show :: OnRemove c -> String #

showList :: [OnRemove c] -> ShowS #

(Typeable c, Typeable k) => Event (OnRemove c) Source # 
Instance details

Defined in Mischief.ECS.Events

data OnRemoveRel (c :: k) Source #

Constructors

OnRemoveRel 

Fields

Instances

Instances details
Show (OnRemoveRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

(Typeable c, Typeable k) => Event (OnRemoveRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

newtype OnSet (c :: k) Source #

Constructors

OnSet 

Fields

Instances

Instances details
Show (OnSet c) Source # 
Instance details

Defined in Mischief.ECS.Events

Methods

showsPrec :: Int -> OnSet c -> ShowS #

show :: OnSet c -> String #

showList :: [OnSet c] -> ShowS #

(Typeable c, Typeable k) => Event (OnSet c) Source # 
Instance details

Defined in Mischief.ECS.Events

data OnSetRel (c :: k) Source #

Constructors

OnSetRel 

Fields

Instances

Instances details
Show (OnSetRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

Methods

showsPrec :: Int -> OnSetRel c -> ShowS #

show :: OnSetRel c -> String #

showList :: [OnSetRel c] -> ShowS #

(Typeable c, Typeable k) => Event (OnSetRel c) Source # 
Instance details

Defined in Mischief.ECS.Events

data Hook (a :: k) Source #

newtype HookContext Source #

Constructors

HookContext 

Fields

data HookRel (a :: k) Source #

newtype Observer e Source #

Constructors

Observer (e -> System ()) 

Instances

Instances details
Typeable e => Component (Observer e) Source # 
Instance details

Defined in Mischief.ECS.Observer

Associated Types

type IsExclusiveRel (Observer e) 
Instance details

Defined in Mischief.ECS.Observer

type IsExclusiveRel (Observer e) Source # 
Instance details

Defined in Mischief.ECS.Observer

(&) :: a -> (a -> b) -> b infixl 1 #

& is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator $, which allows & to be nested in $.

This is a version of flip id, where id is specialized from a -> a to (a -> b) -> (a -> b) which by the associativity of (->) is (a -> b) -> a -> b. flipping this yields a -> (a -> b) -> b which is the type signature of &

Examples

Expand
>>> 5 & (+1) & show
"6"
>>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
3.1406380562059946

Since: base-4.8.0.0