All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.5.0 - 2020-09-23
- Type inference now allows covariance for
Result
andOption
wrapped types- Allows a function of type
Callable[[int], RuntimeError]
to be applied via flatmap (.and_then()
) to a result of typeResult[int, Exception]
- Allows e.g. any of the following to be assigned to a type of
Result[Number, Exception]
:Result[int, RuntimeError]
Result[float, TypeError]
- etc.
- This makes
.and_then()
/.flatmap()
,.map()
,.map_err()
, and so on much more convenient to use in result chains.
- Allows a function of type
1.4.0 - 2020-03-09
- New
Option.collect
constructor to create anOption[Tuple[T, ...]]
from an iterable ofOption[T]
. If all Options in the iterator areSome[T]
, they are collected into a tuple in the resultingSome
. If any areNothing()
, the result isNothing()
.
1.3.1 - 2020-02-21
- Fix pylint
assignment-from-no-return
warnings for methods that can only raise, seen when pylint can determine whether a value is an Ok/Err or Some/Nothing and you try to e.g.Err(5).expect("no good")
.
1.3.0 - 2019-01-12
- Testing in CI for Python 3.8
Option.raise_if_nothing(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
added as a semantically friendly alias forOption.expect
.
Option.raise_if_err
is deprecated in favor ofOption.raise_if_nothing
. Will be removed in2.0.0
1.2.0 - 2019-01-09
Result.raise_if_err(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
added as a semantically friendly alias forResult.expect
.Option.raise_if_err(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
added as a semantically friendly alias forOption.expect
.
1.1.0 - 2019-01-03
Result.collect(iterable: Iterable[T, E]) -> Result[Tuple[T, ...], E]
added to collect an iterable of results into a single result, short-circuiting if any errors are encountered
1.0.2 - 2019-12-12
Result.expect()
andResult.expect_err()
now appends the stringifiedErr
orOk
result to the providedmsg
.
1.0.1 - 2019-12-09
- All interface methods now, through the magic of dependent imports, specify
that they should return implementation instances. This makes working with
functions specified to return a
Result
or anOption
much easier (1780999)
1.0.0 - 2019-05-19
- Result and Option generic type interfaces
- Ok and Err Result implementations
- Some and Nothing Option implementations
- CI pipeline with Azure pipelines
- Full public interface testing
- Makefile for common operations, including venv setup, linting, formatting, and testing
- Basic benchmarks for analyzing performance
- Apache license