Composing Operations with Success and Error Results

A result carrying success or an error can determine whether the next computation should receive a value.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace parse and validation
  2. Decide how errors accumulate

Trace parse and validation

Parsing text "8" can produce the integer eight and then continue to a range test. The input "eight" has no parsed value, so the range stage should propagate the parse error rather than compare text. Composition identifies the intended intermediate type.

Decide how errors accumulate

The same design can report the first failure or collect independent field failures before returning. A set of validators makes this choice explicit in the caller's needs.[1]

References

  1. Python Software Foundation, Functional Programming HOWTO ↩