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

Add the pipe operator |> #36

Closed
2 tasks done
jmackie opened this issue Apr 20, 2022 · 0 comments · Fixed by #41
Closed
2 tasks done

Add the pipe operator |> #36

jmackie opened this issue Apr 20, 2022 · 0 comments · Fixed by #41
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jmackie
Copy link
Member

jmackie commented Apr 20, 2022

It's a fan favourite. The "right pizza" syntax came from F# I think, and has since been copied by Elm, Elixir, et al. Although the idea of "piping" goes back way further.

In Ditto, this operator should just be syntactic sugar. The right-hand side gets called with the left-hand side as its first argument.

lhs |> rhs()
rhs(lhs)

lhs |> rhs(x, y, z)
rhs(lhs, x, y, z)

-- should we allow the right-hand-side to omit parens? Could enforce during parsing
lhs |> rhs
rhs(lhs)

The desugaring should happen when we convert the CST to the "pre" AST, which means no new cases need to be added to the typechecker.

@jmackie jmackie changed the title Pipe operator |> Add the pipe operator |> Apr 20, 2022
@jmackie jmackie added this to the 0.0.2 milestone Apr 20, 2022
@jmackie jmackie added the enhancement New feature or request label Apr 20, 2022
@jmackie jmackie moved this to Todo in Road to 0.1 🚙 Apr 20, 2022
@jmackie jmackie linked a pull request Apr 23, 2022 that will close this issue
4 tasks
@jmackie jmackie self-assigned this Apr 24, 2022
Repository owner moved this from Todo to Done in Road to 0.1 🚙 Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant