avh4/elm-program-test/3.2.0

NOTE: the latest version is 4.0.1

SimulatedEffect.Task

This module parallels elm/core's Task module. Pull requests are welcome to add any functions that are missing.

The functions here produce SimulatedTaskss instead of Taskss and SimulatedEffects instead of Cmds, which are meant to be used to help you implement the function to provide when using ProgramTest.withSimulatedEffects.

Tasks

perform : (a -> msg) -> SimulatedTask Never a -> SimulatedEffect msg
attempt : (Result x a -> msg) -> SimulatedTask x a -> SimulatedEffect msg

This is very similar to perform except it can handle failures!

Chains

andThen : (a -> SimulatedTask x b) -> SimulatedTask x a -> SimulatedTask x b

Chain together a task and a callback.

succeed : a -> SimulatedTask x a

A task that succeeds immediately when run.

fail : x -> SimulatedTask x a

A task that fails immediately when run.

Maps

map : (a -> b) -> SimulatedTask x a -> SimulatedTask x b

Transform a task.

Errors

mapError : (x -> y) -> SimulatedTask x a -> SimulatedTask y a

Transform the error value.