Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer flow to multiple maps and chains #96

Open
thewilkybarkid opened this issue Mar 24, 2021 · 1 comment
Open

Prefer flow to multiple maps and chains #96

thewilkybarkid opened this issue Mar 24, 2021 · 1 comment

Comments

@thewilkybarkid
Copy link

T.map(one),
T.map(two),

and

T.map(one),
T.chain(two),

can become

T.map(flow(
  one,
  two,
)),

and

T.chain(flow(
  one,
  two,
)),

respectively to avoid working in the Task (applies to other categories too).

This applies to 1..n map optionally followed by a chain (where the total number is at least 2).

Probably a bit thorny to catch these cases, but can help readability.

Real examples

@OliverJAsh
Copy link
Contributor

👍

This also makes it easier to extract a function, e.g. to convert from

T.map(flow(
  one,
  two,
)),

to

const fn = flow(
  one,
  two,
);

T.map(fn),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants