Elm Exactly

Rule 134e-task-andthen-fail

Task Reductiontk→⟨a⟩tk′\tk\effred{\opt{\effa}}\tk'
andThen(v,fail v′)→fail v′\frac{\begin{array}{c}\end{array}}{\begin{array}{c}\effandThen(v,\efffail\,v')\effred{}\efffail\,v'\end{array}}
(134)
Read it in its chapter·Permanent address: /standard/rules/e-task-andthen-fail

Comments

The continuation vv is skipped: a failure passes over every andThen\effandThen until an onError\effonError handles it, as rule (135) does. Rule (136) is the dual for success.

TeX source
\defnrule[r:e-task-andthen-fail]
  {}
  {\effandThen(v,\efffail\,v')\effred{}\efffail\,v'}

Tests (2)

  • elm / MinimalTaskAndThenFailTest
    A task chained after a task that fails fails with the same error.
  • 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.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:e-task-andthen-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.