2 ms·
How to create beautiful pipelines on Elixir with Opus
- pmontra 8y agoElixir's with is useful but it's not beautiful. Opus improves on it at the price of setting a standard for passing values along the pipeline. IMHO with has a few problems * It feels like a pipeline but it's not a pipeline, so lines end with a comma instead of starting with |> * It feels like pattern matching but it's not a pattern matching so the left hand is followed by <- instead of = That leads to annoying typographical work when moving code inside the with or back outside and to occasional compilation errors, like a missing comma or a forgotten <- I wish they made it a native feature of the language instead of a macro. They could have made it look a lot nicer. Opus makes those pipelines more readable and adds pipeline linking and forking (link and tee). I'll try it in some project.