Skip to content

"Building pipelines" documentation should mention flow #1255

@tmcw

Description

@tmcw

What is the type of issue?

No response

What is the issue?

The pipelines documentation is decent, but I immediately started to think about how I could combine operations. Like: let's say I take the documentation example of

import { pipe } from "effect"

// Define simple arithmetic operations
const increment = (x: number) => x + 1
const double = (x: number) => x * 2
const subtractTen = (x: number) => x - 10

// Sequentially apply these operations using `pipe`
const result = pipe(5, increment, double, subtractTen)

console.log(result)
// Output: 2

And I want to create a method that's like incrementDoubleAndSubtractTen.

The naive implementation would be

const incrementDoubleAndSubtractTen = pipe(increment, double, subtractTen)

But this doesn't typecheck. The correct solution would be

const incrementDoubleAndSubtractTen = flow(increment, double, subtractTen)

But the flow() method isn't mentioned in these docs or afaict anywhere else in the docs.

Where did you find it?

https://effect.website/docs/getting-started/building-pipelines/

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions