Elm Exactly

Rule 135e-task-onerror-fail

Task Reductiontk→⟨a⟩tk′\tk\effred{\opt{\effa}}\tk'
⊢v v′⇒tkonError(v,fail v′)→tk\frac{\begin{array}{c}\japp{v}{v'}{\tk}\end{array}}{\begin{array}{c}\effonError(v,\efffail\,v')\effred{}\tk\end{array}}
(135)
Read it in its chapter·Permanent address: /standard/rules/e-task-onerror-fail

Referred to from

TeX source
\defnrule[r:e-task-onerror-fail]
  {\japp{v}{v'}{\tk}}
  {\effonError(v,\efffail\,v')\effred{}\tk}

Tests (4)

  • elm / MinimalTaskOnErrorTest
    An error handler replaces a task that fails.
  • elm-core / TaskAttemptErrorTest
    `Task.attempt` delivers both outcomes to `update` in a `Platform.worker`: `Ok` with the value of a succeeding task and `Err` with the error of a failing one.
  • elm-core / TaskOnErrorCascadeTest
    `Task.onError` recovers a failed `Task.andThen` chain, skipping the steps between the failure and the handler, and the recovered task can be chained further.
  • elm-core / TaskOnErrorInnerTest
    `Task.onError` lets its task take steps before it succeeds or fails.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:e-task-onerror-fail] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.