See the documentation about "active patterns" in MLStyle and F#. We should consider supporting those.
The old Rematch had a PR for Scala-like extractors, which are similar. https://github.com/RelationalAI-oss/Rematch.jl/pull/28
Rematch