PaackEng/paack-ui/3.4.0

NOTE: the latest version is 7.23.0

UI.Effect

UI.Effect is a combination of every command required for paack-ui to work correctly. The data describing each side-effect is publicly available, performing the side-effects is left to the user.

Can be used along with elm-program-test to test your application flow.

This module parallels elm/core's Platform.Cmd module, but with some additional helpers for creating Effect values.

Note: If you don't know about commands yet, do not worry if this seems confusing at first, commands will make more sense if you go through the Elm Architecture Tutorial first to see how they fit in real applications.

Create

type alias Effect msg =
List (SideEffect msg)

A list of side-effects to be performed later.

type SideEffect msg
= MsgToCmd msg
| Analytics Analytics

The SideEffect msg type is used for describing commands for later inspection.

none : Effect msg

Tells the perform function that there are no side-effects. Parallels Cmd.none.

batch : List (Effect msg) -> Effect msg

Batch effects together. Parallels Cmd.batch.

msgToCmd : msg -> Effect msg

The effect of returning a msg.

analytics : Analytics -> Effect msg

The effect of returning Analytics.

Transform

map : (a -> b) -> Effect a -> Effect b

Transform the messages produced by a effect. Parallels Cmd.map.

perform : Effect msg -> Cmd msg

Perform a minimal interpretation of side-effects into commands. Use this if you don't care to change how to interpret them.