tricycle / elm-actor-framework / Framework.Actor

Component

Actor

Process

Component Utility

Process Utility


Component


type alias Component appFlags componentModel componentMsgIn componentMsgOut output frameworkMsg =
{ init : ( Pid
, appFlags ) -> ( componentModel
, List componentMsgOut
, Platform.Cmd.Cmd componentMsgIn )
, update : componentMsgIn -> componentModel -> ( componentModel
, List componentMsgOut
, Platform.Cmd.Cmd componentMsgIn )
, subscriptions : componentModel -> Platform.Sub.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 
}

fromComponent : { toAppModel : componentModel -> appModel, toAppMsg : componentMsgIn -> appMsg, fromAppMsg : appMsg -> Maybe componentMsgIn, onMsgOut : { self : Pid, msgOut : componentMsgOut } -> Framework.Internal.Message.FrameworkMessage appFlags appAddresses appActors appModel appMsg } -> Component appFlags componentModel componentMsgIn componentMsgOut output (Framework.Internal.Message.FrameworkMessage appFlags appAddresses appActors appModel appMsg) -> Actor appFlags componentModel appModel output (Framework.Internal.Message.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 =
Framework.Internal.Actor.ProcessMethods componentModel appModel output frameworkMsg

Process Identifier


type alias Pid =
Framework.Internal.Pid.Pid

The type of a Pid

spawnedBy : Pid -> Pid

Retrieve the Pid responsible for spawning the given Pid

Component Utility

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

Transform your components init function

altUpdate : ((componentMsgIn -> componentModel -> ( componentModel, List componentMsgOut, Platform.Cmd.Cmd componentMsgIn )) -> componentMsgIn -> componentModel -> ( componentModel, List componentMsgOut, Platform.Cmd.Cmd componentMsgIn )) -> Component appFlags componentModel componentMsgIn componentMsgOut output frameworkMsg -> Component appFlags componentModel componentMsgIn componentMsgOut output frameworkMsg

Transform your components update function

altSubscriptions : ((componentModel -> Platform.Sub.Sub componentMsgIn) -> componentModel -> Platform.Sub.Sub componentMsgIn) -> Component appFlags componentModel componentMsgIn componentMsgOut output frameworkMsg -> Component appFlags componentModel componentMsgIn componentMsgOut output frameworkMsg

Transform your components subscriptions function

altView : (((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

pidSystem : Pid

The System's Pid

pidCompare : Pid -> Pid -> Basics.Order

Compare two Pid's

pidEquals : Pid -> Pid -> Basics.Bool

Check if two Pid's are in fact the same

pidToInt : Pid -> Basics.Int

Returns an Integer representation of a Pid.

pidToString : Pid -> String

Returns a String representation of a Pid.

unsafePidFromInt : Basics.Int -> Pid

Create a Pid from an Int, should only be used when writing tests