Skip to content

Commit 9d0c34a

Browse files
Closes #706 refactor flow function (#871)
* Closes #706 refactor function * Update flow.py * Update flow.py Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent f19536c commit 9d0c34a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ See [0Ver](https://0ver.org/).
1212

1313
- Makes `_Nothing` a singleton
1414
- Fixes typos in documentation
15-
15+
- Refactor `flow` function
1616

1717
## 0.15.0 aka The initial HKT release
1818

returns/_internal/pipeline/flow.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from functools import reduce
22
from typing import TypeVar
33

4-
from returns.functions import compose
54

65
_InstanceType = TypeVar('_InstanceType')
76
_PipelineStepType = TypeVar('_PipelineStepType')
@@ -49,4 +48,8 @@ def flow(
4948
5049
Requires our :ref:`mypy plugin <mypy-plugins>`.
5150
"""
52-
return reduce(compose, functions)(instance) # type: ignore
51+
return reduce( # type: ignore
52+
lambda composed, function: function(composed),
53+
functions,
54+
instance,
55+
)

0 commit comments

Comments
 (0)