linsyking/messenger-core/8.2.4

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.

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/elm-messenger/messenger-core.

What we checked: The repo moved to github.com/elm-messenger/messenger-core. Rebuilt with git archive from commit 880cd29cd669 of https://github.com/elm-messenger/messenger-core (zip prefix linsyking-messenger-core-08ee779/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 d9b19b92a1d2b75f0ccfe9b98d21c03d0ee50c78.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/linsyking/messenger-core/zipball/8.2.4/

Messenger.Component.PortableComponent

Portable components

These are components that might be provided by an elm package.

There are some limitations for portable components:

  • They don't have the base data
  • They cannot get the common data
  • They cannot change scene
  • You need to set the msg and target type for every dependent portable component
  • You need to provide a codec in the layer to translate the messages and targets

A concrete portable component can generate two kinds of abstract component: Specific Component or General Portable Component.

type alias ConcretePortableComponent data userdata tar msg =
{ init : PortableComponentInit userdata msg data
, update : PortableComponentUpdate data userdata tar msg
, updaterec : PortableComponentUpdateRec data userdata tar msg
, view : PortableComponentView userdata data
, matcher : Matcher data tar
}

ConcretePortableComponent

Used when createing a portable component.

Use translatePortableComponent to create a ConcreteUserComponent from a ConcretePortableComponent.

The scenemsg type is replaced by () because you cannot send changescene message.

type alias PortableMsgCodec specificmsg generalmsg =
{ encode : generalmsg -> specificmsg
, decode : specificmsg -> generalmsg
}

Portable Component Message Codec

type alias PortableTarCodec specifictar generaltar =
{ encode : generaltar -> specifictar
, decode : specifictar -> generaltar
}

Portable Component Target Codec

Specific Component

You can generate a general type of component from a concrete portable component, which means you can manage this component with a list of user components.

ConcretePortableComponent data userdata tar msg
-> PortableTarCodec tar gtar
-> PortableMsgCodec msg gmsg
-> bdata
-> Env cdata userdata
-> gmsg
-> AbstractComponent cdata userdata gtar gmsg bdata scenemsg

genPortableComponentSpecific

Generate abstract component in a specific component type from concrete component.

ConcretePortableComponent data userdata tar msg
-> PortableTarCodec tar gtar
-> PortableMsgCodec msg gmsg
-> bdata
-> ConcreteUserComponent
data
cdata
userdata
gtar
gmsg
bdata
scenemsg

Translate a ConcretePortableComponent to a specific ConcreteUserComponent. Then you can treat it as a normal component in the declared type

This will add an empty basedata provided when init and upcast target and messages to the generalized type.

You should also pass CommonData and SceneMsg with any value, which means you just need to match the data type.

General Portable Component

You can generate a component in specific type from a concrete portable component, which means you can manage this component in a list for all general portable components generated in this type.

You should update this type of components by using specialized function provided.

type alias AbstractGeneralPortableComponent userdata tar msg =
AbstractComponent () userdata tar msg () ()

AbstractPortableComponent

Abstract General Portable Component with common data, base data, and scene msg set to unit type.

This means you cannot send scene msg from a portable component. And you cannot put a general portable component in a list of other user components.

ConcretePortableComponent data userdata tar msg
-> PortableTarCodec tar gtar
-> PortableMsgCodec msg gmsg
-> Env cdata userdata
-> gmsg
-> AbstractGeneralPortableComponent userdata gtar gmsg

genPortableComponentGeneral

Generate abstract component in general portable type from concrete component.

you don't need to give a Env without commondata

ConcretePortableComponent data userdata tar msg
-> PortableTarCodec tar gtar
-> PortableMsgCodec msg gmsg
-> ConcreteUserComponent data () userdata gtar gmsg () ()

Translate a ConcretePortableComponent to a special kind of ConcreteUserComponent. **Then you should treat it as a general portable component, in the same type of other general portable components **

This will add an empty basedata (unit) when init and upcast target and messages to the generalized type.

The commondata and scenemsg will also be set to unit type.

Env cdata userdata
-> List (AbstractGeneralPortableComponent userdata tar msg)
-> ( List (AbstractGeneralPortableComponent userdata tar msg)
, List (MsgBase msg (SceneOutputMsg scenemsg userdata))
, ( Env cdata userdata, Bool )
)

updatePortableComponents

Update a list of abstract general portable components.

Use this function instead of updateComponents to update general portable components!

you don't need to give a Env without commondata

Env cdata userdata
-> List (Msg tar msg (SceneOutputMsg () userdata))
-> List (AbstractGeneralPortableComponent userdata tar msg)
-> ( List (AbstractGeneralPortableComponent userdata tar msg)
, List (MsgBase msg (SceneOutputMsg scenemsg userdata))
, Env cdata userdata
)

updatePortableComponentsWithTarget

Update a list of abstract portable components with target msgs.

Use this function instead of updateComponentsWithTarget to update general portable components!

you don't need to give a Env without commondata

Type sugar

type alias PortableComponentInit userdata msg data =
Env () userdata -> msg -> data

Portable component init type sugar

type alias PortableComponentUpdate data userdata tar msg =
Env () userdata
-> data
-> ( data
, List (Msg tar msg (SceneOutputMsg () userdata))
, ( Env () userdata, Bool )
)

Portable component update type sugar

type alias PortableComponentUpdateRec data userdata tar msg =
Env () userdata
-> msg
-> data
-> ( data
, List (Msg tar msg (SceneOutputMsg () userdata))
, Env () userdata
)

Portable component updaterec type sugar

type alias PortableComponentView userdata data =
Env () userdata -> data -> ( Renderable, Int )

Portable component view type sugar

type alias PortableComponentStorageSpecific cdata userdata tar msg gtar gmsg bdata scenemsg =
PortableTarCodec tar gtar
-> PortableMsgCodec msg gmsg
-> bdata
-> Env cdata userdata
-> gmsg
-> AbstractComponent cdata userdata gtar gmsg bdata scenemsg

Portable component storage as a specific component type sugar

type alias PortableComponentStorageGeneral cdata userdata tar msg gtar gmsg =
PortableTarCodec tar gtar
-> PortableMsgCodec msg gmsg
-> Env cdata userdata
-> gmsg
-> AbstractGeneralPortableComponent userdata gtar gmsg

Portable component storage as general portable component type sugar