Allow a case expression inside a pipeline #4216
Closed
Norlock
started this conversation in
Ideas & suggestions
Replies: 2 comments 5 replies
-
You can already do this today: [0, 2, 1]
|> list.sort(int.compare)
|> fn(value) {
case value {
0 -> "0"
1 -> "1"
2 -> "2"
}
}
|> string.append(" - number") Although personally, at this point I would either split up the pipeline into several parts, or extract the (Note: this code doesn't actually compile, but neither would your example) |
Beta Was this translation helpful? Give feedback.
4 replies
-
This doesn't solve any particular problem today and it adds a second way to do something, so it is unlikely to be accepted. There needs to be clear value for any new features as keeping the language small with little to no changes it a goal of ours. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Maybe it would be nice to allow case expressions directly together with pipelines. Now you always have to break up or wrap it in an extra function block, suggestion:
It would skip the case keyword and immediately use a function. You can also use function identity
to use a case without some other function, but maybe with a catchier name, like
pipe.value
.Beta Was this translation helpful? Give feedback.
All reactions