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 pipe to nested call expressions #279

Open
OliverJAsh opened this issue Sep 4, 2022 · 2 comments
Open

Prefer pipe to nested call expressions #279

OliverJAsh opened this issue Sep 4, 2022 · 2 comments

Comments

@OliverJAsh
Copy link
Contributor

import { pipe } from "fp-ts/function";

declare const a: (n: number) => number;
declare const b: (n: number) => number;
declare const c: (n: number) => number;

// ❌
c(b(a(1)));

// ✅
pipe(1, a, b, c);
@mlegenhausen
Copy link

Opinions on?

import { pipe } from "fp-ts/function";

declare const a: (n: number) => number;

// ❌
pipe(1, a);

// ✅
a(1);

@samhh
Copy link

samhh commented Feb 20, 2023

@mlegenhausen I was about to comment the same thing! I'd personally prefer a(1) until a second function is applied, then preferring pipe.

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

3 participants