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

Pipe into case expression #2575

Closed
zdcthomas opened this issue Feb 2, 2024 · 1 comment
Closed

Pipe into case expression #2575

zdcthomas opened this issue Feb 2, 2024 · 1 comment

Comments

@zdcthomas
Copy link

First off, this is such a cool and exciting project!

Second, in Elixir, I'll quite often use a case at the end or middle of a pipe, saving unnecessary assignments, and I was wondering if it might be cool to implement the same thing here in Gleam!
Taking an example from new interactive tutorial (awesome btw) it could look something like

  1
  |> case {
    // Match specific values
    0 -> "Zero"
    1 -> "One"

    // Match any other value
    _ -> "Other"
  }
  |> io.debug()

I would be super happy to take this on, but I might have to ask some questions in the discord if that's alright!

Also if this has already been discussed, then super sorry for the wasted issue. I took a look and didn't see anything but I could have totally missed it.
Thanks!

@zdcthomas
Copy link
Author

Talked the idea through with some folks on the discord and decided that, for a couple reasons (ambiguity with cases with multiple subjects, code style) piping directly into a case isn't the way Gleam wants to go, so I'm gonna go ahead and close this issue.

@zdcthomas zdcthomas closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2024
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

1 participant