linsyking/messenger-core/14.0.0

NOTE: the latest version is 20.0.0

Renamed to elm-messenger/messenger-core. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as linsyking/messenger-core still install under that name. 34 versions of 52 come from the new location (see their notes). 7 versions could not be recovered and cannot be installed.

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: Software Heritage has not archived the repo; no fork with tag 14.0.0 found (17 same-name repos checked); no cached copy. Use another version.

Details

Messenger.GeneralModel

General Model

General model is designed to be an abstract interface of layers, components, etc..

A Gernel model has the ability to:

  • specialize its own data types
  • share some data types with objects in the same type
  • be initialized by some inputs
  • be updated by event and msgs
  • be updated in a list of same type objects
  • send msg to the objects in the same type
  • send msg to the parent object
  • render itself
  • identify itself by a matcher
type Msg othertar msg sommsg
= Parent (MsgBase msg sommsg)
| Other ( othertar, msg )

The Basic Msg Model.

Using Other when sending msg to objects in the same type. Make sure the othertar can pass the matcher of target object.

type MsgBase othermsg sommsg
= SOMMsg sommsg
| OtherMsg othermsg

MsgBase

Used when sending a msg to parent object.

Using SOMMsg when sending a SceneOutputMsg, which will be directedly handled by Top-level.

filterSOM : List (MsgBase othermsg sommsg) -> List sommsg

Filter SOMMsg from list of MsgBase.

type alias ConcreteGeneralModel data env event tar msg ren bdata sommsg =
{ init : env -> msg -> ( data, bdata )
, update :
env
-> event
-> data
-> bdata
-> ( ( data, bdata ), List (Msg tar msg sommsg), ( env, Bool ) )
, updaterec :
env
-> msg
-> data
-> bdata
-> ( ( data, bdata ), List (Msg tar msg sommsg), env )
, view : env -> data -> bdata -> ren
, matcher : data -> bdata -> tar -> Bool
}

Concrete General Model.

Users deal with the fields in concrete model.

type AbstractGeneralModel env event tar msg ren bdata sommsg
= Roll
(UnrolledAbstractGeneralModel
env
event
tar
msg
ren
bdata
sommsg
)

Rolled Abstract General Model.

Cannot be directedly modified. Used for storage.

AbstractGeneralModel env event tar msg ren bdata sommsg
-> UnrolledAbstractGeneralModel env event tar msg ren bdata sommsg

Unroll a rolled abstract model.

ConcreteGeneralModel data env event tar msg ren bdata sommsg
-> msg
-> env
-> AbstractGeneralModel env event tar msg ren bdata sommsg

Abstract a concrete model to an abstract model.

Initialize it with env and msg.

Env common userdata
-> List
(Env common userdata)
tar
msg
Renderable
bdata
sommsg
)
-> List Renderable

View model list.

type alias Matcher data tar =
data -> tar -> Bool

A general matcher type sugar

Result Remapper

( ( List (Msg tar msg sommsg), ( env, Bool ) )
-> ( List (Msg tar msg sommsg), ( env, Bool ) )
)
-> AbstractGeneralModel env event tar msg ren bdata sommsg
-> AbstractGeneralModel env event tar msg ren bdata sommsg

Change the update function to remap the result and return the changed abstract general model.

( ( List (Msg tar msg sommsg), env )
-> ( List (Msg tar msg sommsg), env )
)
-> AbstractGeneralModel env event tar msg ren bdata sommsg
-> AbstractGeneralModel env event tar msg ren bdata sommsg

Change the updaterec function to remap the result and return the changed abstract general model.