webbhuset/elm-actor-model/1.0.0

NOTE: the latest version is 4.0.0

Webbhuset.ActorSystem

type alias PID =
PID

A PID is an identifier for a Process.

Build and Initialize the System

{ init : flags -> SysMsg name appMsg
, spawn : name -> PID -> ( appModel, SysMsg name appMsg )
, apply : appModel -> AppliedActor appModel (SysMsg name appMsg)
}
-> Program flags (Model name appModel) (SysMsg name appMsg)

Create a Browser.element from your Actor System

{ init : flags -> Url -> Key -> SysMsg name appMsg
, spawn : name -> PID -> ( appModel, SysMsg name appMsg )
, apply : appModel -> AppliedActor appModel (SysMsg name appMsg)
, onUrlRequest : UrlRequest -> SysMsg name appMsg
, onUrlChange : Url -> SysMsg name appMsg
}
-> Program flags (Model name appModel) (SysMsg name appMsg)

Create a Browser.application from your Actor System

System Messages

Use these to send messages between actors in your system.

none : SysMsg name appMsg

Don't send anything.

Similar concept to Cmd.none

batch : List (SysMsg name appMsg) -> SysMsg name appMsg

Batch control messages

Similar concept to Cmd.batch

kill : PID -> SysMsg name appMsg

Kill a process

toAppMsg : appMsg -> SysMsg name appMsg

Wrapper for you app's msg type

sendToPID : PID -> SysMsg name appMsg -> SysMsg name appMsg

Send a message to a Process

sendToSingleton : name -> SysMsg name appMsg -> SysMsg name appMsg

Send a message to a Singleton Process

spawn : name -> (PID -> SysMsg name appMsg) -> SysMsg name appMsg

Spawn a process. The PID will be send as a reply msg.

spawnSingleton : name -> SysMsg name appMsg

Spawn a singleton process.

addView : PID -> SysMsg name appMsg

Add a process to the global output.

Bootstrap

Don't worry about these for now.

type AppliedActor appModel msg

An actor after the model has been applied

type Model name appModel

The Global Model

type alias SysMsg name appMsg =
Msg name appMsg

Your Elm Program will have this as its Msg type.

Actor compModel appModel msg
-> compModel
-> AppliedActor appModel msg

Apply the compModel to an actor.