justgook/elm-game-logic/1.0.0

NOTE: the latest version is 3.0.0

Logic.Component.Singleton

type alias Spec comp world =
{ get : world -> comp
, set : comp -> world -> world
}

Main way of creating ECS "anti-pattern", but time to time you need to create some component that can exist only one per whole application (viewport, keyboard, websocket-connection, etc. )

{ get : world -> comp
, set : comp -> world -> world
}
-> (comp -> comp)
-> world
-> world

Update whole component set, can be used also with Component.Set (not only Singleton)