Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.02 KB

option.rst

File metadata and controls

26 lines (19 loc) · 1.02 KB

xoutil.fp.option - Functional Programming Option Type

xoutil.fp.option

Further Notes

It could be thought that this kind of concept is useless in Python because the dynamic nature of the language, but always there are certain logic systems that need to wrap "correct" false values and "incorrect" true values.

Also, in functional programming, errors can be reasoned in a new way: more like as error values than in exception handling. Where the Maybe type expresses the failure possibility through Wrong instances encapsulating errors.

When receiving a Wrong instance encapsulating an error, and want to recover the exception propagation style -instead of continue in pure functional programming-, to re-raise the exception, instead the raise Python statement, use ~xoutil.eight.errors.throw.

See https://en.wikipedia.org/wiki/Monad_%28functional_programming%29#\ The_Maybe_monad