♻️ Refactoring complex `else` clauses in `with` (an anti-pattern)
Elixir's `with` clauses are awesome for organizing happy paths. But sometimes the `else` clauses get really messy and difficult to understand. Let's refactor that.
Elixir's `with` clauses are awesome for organizing happy paths. But sometimes the `else` clauses get really messy and difficult to understand. Let's refactor that.
When we use function-head pattern matching as control flow and as an extraction mechanism, we make it difficult to know what's important in our code and what's merely convenience! Let's refactor it.