Make your functions return something meaningful, typed, and safe!
Announcing article: https://sobolevn.me/2020/02/typed-functional-dependency-injection
Breaking: renames join
to flatten
, sorry!
Breaking: renames box
to bind
and moves it to returns.pointfree
Breaking: removes Maybe.rescue
and Maybe.fix
methods
Breaking: renames io_squash
to squash_io
and moves it to returns.converters
Breaking: moves all interfaces from returns.primitives.container
to
returns.primitives.interfaces
Adds rescue
pointfree function
Adds ResultE
alias for Result[..., Exception]
Adds RequiresContext
container and Context
helper class
Adds RequiresContext
support for bind
pointfree function
Adds RequiresContext
support for flatten
function
Adds RequiresContextResult
container
Adds RequiresContextResultE
alias
Adds ReaderResult
and ReaderResultE
aliases
for RequiresContextResult[..., ..., Exception]
Adds RequiresContextResult
support for bind
and rescue
Adds RequiresContextResult
support for flatten
Adds IOResult
helper to work better with IO[Result[a, b]]
Adds IOResultE
alias for IOResult[a, Exception]
Adds IOResult
support for bind
Adds IOResult
support for flatten
Adds IOResult
support for @pipeline
Adds IOResult
support for coalesce
Adds IOResult
support for is_successful
Adds RequiresContextIOResult
container
Adds RequiresContextIOResultE
alias
Adds ReaderIOResult
and ReaderIOResultE
aliases
for RequiresContextIOResult[..., ..., Exception]
Adds RequiresContextIOResult
support for bind
and rescue
Adds RequiresContextIOResult
support for flatten
Adds Result.lift
, Maybe.lift
, RequiresContext.lift
,
and RequiresContextResult.lift
functions in addition to IO.lift
Adds Immutable
primitive type
Adds Unitable
protocol and .from_success()
and .from_failure()
methods for all Result
realted classes
Adds Instanceable
protocol and .from_value()
method
for IO
and RequiresContext
Adds flow
function, which is similar to pipe
Adds swap
coverter for Result
and IOResult
Adds squash_context
function to squash RequiresContext
similar to IO
Success
and Failure
(both io
and pure) return Any
and not NoReturn
flatten
works, also adds more tests and docs about Failure
caseUnwrappable
type being parametrized with only one TypeVar
Success
and Failure
to return Any
instead of NoReturn
poetry
version in travis
pipe
docs with lambda
and Generic
problemmypy
in CI@pipeline
requires a container type when created:
@pipeline(Result)
or @pipeline(Maybe)
Maybe
and Result
now has success_type
and failure_type
aliasesResult.unify
utility method for better error type compositiondry-python/classes
as a first-class citizenio_squash
to squash several IO
containers into one container
with a tuple inside, currently works with 9
containers max at a timeuntap
function which does convert return type to None
multiprocessing
BaseContainer
is the first childNothing
had incorrect docstringsgenerated
package is protectedpoetry
to 1.0
pipe()
does not require argument to be the first value,
instead it is required to use: pipe(f1, f2, f3, f4)(value)
returns/__init__.py
,
because we now have quite a lot of stuffNothing.fix
Nothing.rescue
Maybe
now has .failure()
to match the same API as Result
identity
functiontap
functionpipe
allows to pipe 8 stepscoalesce_result
and coalesce_maybe
coverters.fix
and .rescue
of Maybe
might be called twiceSuccess
and _Success
, Failure
and _Failure
@pipeline
typesafety/
testspython>=3.7,<=3.7.2
are not supported anymore,
because of a bug inside typing
modulebind
does not change the type of an errorrescue
does not change the type of a valuemap_failure
to alt
box()
function with the ability
to box function for direct container composition like:
a -> Container[b]
to Container[a] -> Container[b]
IO.lift()
function to lift a -> a
to IO[a] -> IO[a]
pipe()
function to pipeline.py
__hash__()
magic methods to all containersAny
to NoReturn
in Success
and Failure
Result
, Maybe
, and IO
are covariantmypy
versionwemake-python-styleguide
and introduces nitpick
pytest-plugin-mypy
, all tests now use yml
Maybe
monad, typed!mypy
plugin to type decoratorsResult
typesSuccess
and Failure
are not types, but functionsFixableContainer
and ValueUnwrapContainer
IO
container from Result.bind
@pipeline
return type.py
filesIO
and Container
conceptAlpha
to Beta
IO
markerunsafe
module with unsafe functions@pipeline
is_successful
is publicraise_exception
is publicstr()
function works for container typescompose
helper functionimport returns
raise_exception
helper function.unwrap()
mypy
BSD
.pyi
filesfmap
to map
do_notation
to pipeline
, moves it to functions.py
ebind
to rescue
efmap
to fix
Monad
to Container
Maybe
monad, since typing does not have NonNullable
type