github dry-python/returns 0.15.0
Version 0.15.0 aka The initial HKT release

latest releases: 0.22.0, 0.21.0, 0.20.1...
3 years ago

Features

  • Adds Higher Kinded Types partial support

  • Breaking: drops python3.6 support

  • Breaking: makes our mypy plugin not optional, but required!

  • Breaking: changes all RequiresContext-based type arguments order,
    previously we used to specify _EnvType as the first type argument,
    now it is the last one. This is done to respect new HKT rules

  • Breaking: renames .rescue to .lash

  • Breaking: removes all old interfaces from primitives/interfaces.py,
    use new typeclasses instead

  • Breaking: Maybe is fully reworked to be lawful

  • Breaking: removes value_or pointfree method,
    because it is impossible to express with HKT

  • Breaking: removes .value_or, .unwrap, and .failure methods
    from FutureResult and RequiresContext-based types,
    because we do require these methods to raise an exception on failure,
    but these methods were lazy and did not raise the required exception

  • Breaking: changes how is_successful is typed:
    now we allow any Unwrappable interface instances there,
    including custom ones

  • Breaking: changes UnwrapFailedError constructor,
    now it does accept an Unwrappable instance instead of a BaseContainer

  • Breaking: removes .fix method from all containers,
    also removes fix pointfree function

  • Breaking: Removes coalesce function,
    because it is impossible to properly type it

  • Breaking: Removes all Context* based types with .ask() method,
    use new .ask() methods on the Reader-based containers

  • Breaking: Now Future and FutureResult can be awaited multiple times

  • Breaking: Removes .unify() method from several containers,
    use unify() pointfree function instead

  • Breaking: Removes .from_iterable method from all containers,
    instead adds better iterables support,
    we now have returns.iterables module with Fold helper

  • Breaking: Renames property empty to no_args of
    all RequiresContext-based classes

  • Adds new public interfaces: see returns.interfaces

  • Adds methods package with several helpful things inside

  • Adds FutureSuccess and FutureFailure unit functions
    to be similar to Result and IOResult

  • Adds .swap method to Result, IOResult, FutureResult,
    and other result based containers

  • Adds .modify_env method to all RequiresContext* types

  • Adds .rescue to Maybe

  • Adds .equals methods to types that can be compared directly:
    Result, Maybe, IO, IOResult

  • Adds missing from_requires_context_future_result to RequiresContext

  • Adds .from_optional and .bind_optional to Maybe container

  • Adds __slots__ to UnwrapFailedError with halted_container

  • Changes flatten to work with KindN and any possible container

  • Adds a helper to test traces to our pytest plugin

  • Adds cond function to pointfree and methods packages

  • Adds compose_result HKT method and pointfree function

  • Adds unify HKT pointfree function

  • Adds bimap pointfree function

  • Adds unwrap_or_failure function to methods package

  • Adds collect_trace helper function for better development experience

  • Adds hypothesis intergration and pre-defined "monad laws as values"

  • Adds assert_equal method to our pytest plugin

Bugfixes

  • Breaking: fixes serious typing issue and changes how flow works
  • Breaking: fixes serious typing issue and changes how pipe works,
    now it has a hard limit of 20 parameters
  • Fixes that RequiresContextFutureResult was not supported by pytest plugin
  • Fixes incorrect partial behaviour in an edge case, #618
  • Fixes that .apply method of IOResult was working incorrectly,
    it was returning IOFailure(2)
    as a result of IOFailure(1).apply(IOFailure(2))
  • Fixes bug that safe(tap(...)) was revealing invalid types sometimes

Misc

  • Adds a lot of new typetests
  • Checks that now all math laws are checked for all types
  • Changes docs structure, adds new Interfaces, HKT, and Methods pages
  • Changed __str__ method in BaseContainer class to __repr__ method
  • Adds Quickstart guide

Don't miss a new returns release

NewReleases is sending notifications on new releases.