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.Actor

type alias Component appFlags componentModel componentMsgIn componentMsgOut output frameworkMsg =
{ init :
( Pid, appFlags )
-> ( componentModel, List componentMsgOut, Cmd componentMsgIn )
, update :
componentMsgIn
-> componentModel
-> ( componentModel, List componentMsgOut, Cmd componentMsgIn )
, subscriptions : componentModel -> Sub componentMsgIn
, view :
(componentMsgIn -> frameworkMsg)
-> componentModel
-> (Pid -> Maybe output)
-> output
}

Actor

type alias Actor appFlags componentModel appModel output frameworkMsg =
{ processMethods :
ProcessMethods componentModel appModel output frameworkMsg
, init : ( Pid, appFlags ) -> ( appModel, frameworkMsg )
, apply : componentModel -> Process appModel output frameworkMsg
}
{ toAppModel : componentModel -> appModel
, toAppMsg : componentMsgIn -> appMsg
, fromAppMsg : appMsg -> Maybe componentMsgIn
, onMsgOut :
{ self : Pid
, msgOut : componentMsgOut
}
-> FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg
}
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
output
(FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg
)
-> Actor
appFlags
componentModel
appModel
output
(FrameworkMessage
appFlags
appAddresses
appActors
appModel
appMsg
)

Progress a Component into an Actor by supplying it functions of how to handle application types.

Process

type alias ProcessMethods componentModel appModel output frameworkMsg =
ProcessMethods componentModel appModel output frameworkMsg
type alias Process appModel output frameworkMsg =
Process appModel output frameworkMsg

An Actor that has been spawned inside the framework always receives an unique identifier (PID).

The PID also holds information about who spawned (started) the process.

Process Identifier

type alias Pid =
Pid

The type of a Pid

spawnedBy : Pid -> Pid

Retrieve the Pid responsible for spawning the given Pid

Component Utility

( ( ( Pid, a )
-> ( componentModel, List componentMsgOut, Cmd componentMsgIn )
)
-> ( Pid, appFlags )
-> ( componentModel, List componentMsgOut, Cmd componentMsgIn )
)
-> Component
a
componentModel
componentMsgIn
componentMsgOut
output
frameworkMsg
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
output
frameworkMsg

Transform your components init function

( ( componentMsgIn
-> componentModel
-> ( componentModel, List componentMsgOut, Cmd componentMsgIn )
)
-> componentMsgIn
-> componentModel
-> ( componentModel, List componentMsgOut, Cmd componentMsgIn )
)
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
output
frameworkMsg
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
output
frameworkMsg

Transform your components update function

( (componentModel -> Sub componentMsgIn)
-> componentModel
-> Sub componentMsgIn
)
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
output
frameworkMsg
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
output
frameworkMsg

Transform your components subscriptions function

( ( (componentMsgIn -> frameworkMsg)
-> componentModel
-> (Pid -> Maybe outputA)
-> outputA
)
-> (componentMsgIn -> frameworkMsg)
-> componentModel
-> (Pid -> Maybe outputB)
-> outputB
)
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
outputA
frameworkMsg
-> Component
appFlags
componentModel
componentMsgIn
componentMsgOut
outputB
frameworkMsg

Transform your components view function

Process Utility

pidCompare : Pid -> Pid -> Order

Compare two Pid's

pidEquals : Pid -> Pid -> Bool

Check if two Pid's are in fact the same

pidToInt : Pid -> Int

Returns an Integer representation of a Pid.

pidToString : Pid -> String

Returns a String representation of a Pid.