tricycle/system-actor-model/8.0.2

NOTE: the latest version is 9.0.0

Renamed to bellroy/system-actor-model. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as tricycle/system-actor-model still install under that name. 26 versions of 26 come from the new location (see their notes).

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/bellroy/system-actor-model.

What we checked: The repo moved to github.com/bellroy/system-actor-model. Rebuilt with git archive from commit 18ae67c77f4c of https://github.com/bellroy/system-actor-model (zip prefix tricycle-system-actor-model-499fdd3/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 5ba0270fce809eb1f5449bdcb89c7add0c71b548.

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/tricycle/system-actor-model/zipball/8.0.2/

System.Message

System Messages

type alias SystemMessage addresses actors appMsg =
SystemMessage addresses actors appMsg

The type of the System Messages

Spawning and Populating

Spawn an Actor and add it to the System's view

spawn SomeActor populateView

Spawn an Actor, add it to the System's view, and assign it an Address

spawn
    SomeActor
    (\pid ->
        batch
            [ populateView pid
            , populateAddress pid
            ]
    )
actors
-> (PID -> SystemMessage addresses actors appMsg)
-> SystemMessage addresses actors appMsg

Spawn an Actor

Value
-> actors
-> (PID -> SystemMessage addresses actors appMsg)
-> SystemMessage addresses actors appMsg

Spawn an Actor with given flags (as an encoded JSON Value)

populateView : PID -> SystemMessage addresses actors appMsg

Add a PID to the System's view

The System will render views in the order it receives it.

populateAddress : addresses -> PID -> SystemMessage addresses actors appMsg

Add a PID to a given addresses

You can send messages to Addresses just like you can send messages to a PID.

List actors
-> (List PID -> SystemMessage addresses actors appMsg)
-> SystemMessage addresses actors appMsg

Spawn multiple Actors

List ( actors, Value )
-> (List PID -> SystemMessage addresses actors appMsg)
-> SystemMessage addresses actors appMsg

Spawn multiple Actors with given flags

Removing and Destroying

kill : PID -> SystemMessage addresses actors appMsg

Kill a process

This will trigger the Actors onKill event on which you can decide what to do with this Message.

There is a Default behaviour available that will remove the Process from the System.

removeFromView : PID -> SystemMessage addresses actors appMsg

Remove a PID from the System view

removeFromAddress : addresses -> PID -> SystemMessage addresses actors appMsg

Remove a PID from a given addresses

Actor Communication

sendToPid : PID -> appMsg -> SystemMessage addresses actors appMsg

Send a message to a PID.

sendToAddress : addresses -> appMsg -> SystemMessage addresses actors appMsg

Send a message to an addresses.

sendToPidOnAddress : PID -> addresses -> appMsg -> SystemMessage addresses actors appMsg

Send a message to a PID only when it's on the given addresses.

Utility

List (SystemMessage addresses actors appMsg)
-> SystemMessage addresses actors appMsg

Batch perform a list of messages

spawn MyActorWorker
    (\pid ->
        batch
            [ populateAddress pid
            , populateView pid
            ]
    )
noOperation : SystemMessage addresses actors appMsg

Don't do anything

spaw MyActorWorker (always noOperation)
toCmd : msg -> Cmd msg

Converts a generic msg into Cmd.

Application

updateDocumentTitle : String -> SystemMessage addresses actors appMsg

Update the document title

Log

log :
LogMessage addresses actors appMsg
-> SystemMessage addresses actors appMsg

Log a LogMessage

This will trigger the onLogMessage function you provided while initializing your application.

LogMessage addresses actors appMsg
-> SystemMessage addresses actors appMsg

Convenience function that ignores all logs