arowM/elm-thread/2.0.1

NOTE: the latest version is 3.0.1

Thread.Procedure

Core

type Procedure shared global local

Procedures to be processed in a thread.

  • shared: Shared memory
  • global: Global events
  • local: Local events that only affect on the forked thread itself
List (Procedure shared global local)
-> Procedure shared global local

Batch Procedures together. The elements are evaluated in order.

Constructors

none : Procedure shared global local

Construct a Procedure instance that do nothing.

modify : (shared -> shared) -> Procedure shared global local

Construct a Procedure instance that modifies shared memory state.

push : (shared -> Cmd local) -> Procedure shared global local

Construct a Procedure instance that pushes a local Cmd.

(local -> shared -> Maybe (Procedure shared global local))
-> Procedure shared global local

Construct a Procedure instance that awaits the local events for the thread.

If it returns Nothing, it awaits again. Otherwise, it evaluates the given Procedure.

(global -> shared -> Maybe (Procedure shared global local))
-> Procedure shared global local

Construct a Procedure instance that awaits global events.

If it returns Nothing, it awaits again. Otherwise, it evaluates the given Procedure.

(() -> Procedure shared global local)
-> Procedure shared global local

Construct a Procedure instance that evaluates the given Procedure in a forked thread.

The forked thread runs independently of the original thread. i.e., The subsequent Procedures in the original thread are evaluated immediately.

List (Procedure shared global local)
-> Procedure shared global local

Construct a Procedure instance that wait for all given Procedures to be completed.

Given Procedures are evaluated in the independent thread, but the subsequent Procedures in the original thread are not evaluated immediately.

quit : Procedure shared global local

Quit the thread immediately.

Subsequent Procedures are not evaluated and are discarded.

Lower level functions

It is recommended to use Thread.Browser for normal use.

(shared -> Html global)
-> Model shared global local
-> Html (Msg global local)
(shared -> Document global)
-> Model shared global local
-> Document (Msg global local)
shared
-> Procedure shared global local
-> ( Model shared global local, Cmd (Msg global local) )
Msg global local
-> Model shared global local
-> ( Model shared global local, Cmd (Msg global local) )
(shared -> Sub global)
-> Model shared global local
-> Sub (Msg global local)
onUrlRequest : (UrlRequest -> global) -> UrlRequest -> Msg global local
onUrlChange : (Url -> global) -> Url -> Msg global local
type Model shared global local
type Msg global local