tricycle/elm-actor-framework/1.0.0

NOTE: the latest version is 1.4.0

Renamed to bellroy/elm-actor-framework. It is published under that name, and new versions come out there.

Versions published as tricycle/elm-actor-framework still install under that name. 2 versions of 6 come from the new location (see their notes). 4 versions could not be recovered and cannot be installed.

Rerouted (renamed, needs approval). 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/elm-actor-framework.

What we checked: The repo moved to github.com/bellroy/elm-actor-framework and tag 1.0.0 is there; its commit 419d5d52deb1 is from 2021-04-07 01:45 UTC, after the version was published (2020-06-30 13:40 UTC); elm.json differs from package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one and nothing else confirms its contents.

We could not verify this copy against what was published, so the Lamdera compiler asks before using it (y/n). Without a terminal, as in CI, it stops with an error unless approved:

  • lamdera make --auto-approve-package-rerouting approves rerouted versions for that run,
  • LAMDERA_AUTO_APPROVE_PACKAGE_REROUTING=1 does the same for every run in that environment,
  • LAMDERA_CACHE=off skips the Lamdera package server altogether: packages come from package.elm-lang.org and GitHub only, as with elm, and a rerouted version then fails to download.

Details · package.elm-lang.org's zip: https://github.com/tricycle/elm-actor-framework/zipball/1.0.0/

Framework.Message

appFlags
-> appActors
-> ( Pid
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg
)
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Spawn an Actor

spawn () Counter addToView
-- Spawns a `Counter` and adds it to your
-- applications view.


spawn () Counter (\_ -> noOperation)
-- Spawns a `Counter` and doesn't do anything with
-- the newly retrieved Pid.


spawn 10 Counter (\pid -> batch [
      addToView pid
    , populateAddress AllCounters pid
]
-- Spawns a `Counter` and passes it some appFlags
-- (Int 10) then adds it to your
-- applications view and populates an
-- address `AllCounters`.
Pid
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Stops a process (an Actor becomes a Process identified by a Pid after you have spawned it).

This is also stops any processes that the targeted process might have spawned.

If the process is part of the applications view it will be removed.

stopProcess pid
Pid
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Every Actor has a view, but it's up to you to determine the order and even if you want it to render.

The applications view function receives a list of outputs in the order you have added the Pids to the applications view using this function.

spawn Counter addToView
-- Spawns a `Counter` and adds it to your
-- applications view.
appAddresses
-> Pid
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Add an process to an address. Multiple processes can be housed under the same or multiple addresses.

Once a process is listed under an address you can send it messages by using sendToAddress.

batch [
    spawn Counter (populateAddress AllCounters)
    , spawn Counter (populateAddress AllCounters)
]
-- Spawn two Counter Actors and populate the
-- same address (AllCounters).
Pid
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Remove a process from the applications view

appAddresses
-> Pid
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Remove a process from the given address

Actor Intercommunication

Pid
-> appMsg
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Send a process a message using its Pid.

sendToPid pid (CounterMsg Increment)
appAddresses
-> appMsg
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Send a message to an address that mone, a single or multiple processes might receive.

sendToAddress AllCounters (CounterMsg Increment)

Utility

List
(FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg
)
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Batch multiple messages into a single message

batch
    [ spawn Counter (populateAddress AllCounters)
    , spawn Counter (populateAddress AllCounters)
    , updateDocumentTitle "batch example"
    ]
FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

No operation, don't do anything.

spawn Counter (\_ -> noOperation)
-- Spawn a `Counter` and ignore the newly created
-- Pid by returning noOperation.
toCmd : msg -> Cmd msg

Turn any msg into a Cmd.

Document

String
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg

Update the document title

This only works when using Browser.document or Browser.application.

updateDocumenTitle "New Title"

Types

type alias FrameworkMessage appFlags appAddresses appActors appModel appMsg =
FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg