Skip to content

v1.5.0 - Covariance of Wrapped Types

Latest
Compare
Choose a tag to compare
@mplanchard mplanchard released this 23 Sep 23:04
· 1 commit to master since this release
v1.5.0
c360380

1.5.0 - 2020-09-23

Added

  • Type inference now allows covariance for Result and Option wrapped types
    • Allows a function of type Callable[[int], RuntimeError] to be applied
      via flatmap (.and_then()) to a result of type Result[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.