Strict pattern matching mode #214
thenonameguy
started this conversation in
Ideas
Replies: 1 comment
-
|
The first half can be implemented as (defmacro find! [& rules]
`(m/find ~@rules _otherwise# (throw (ex-info "Non-exhaustive pattern match" {})))The second part, however, is not something |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
It would be great to have an
m/find!macro, which keeps the interface of the bang-less one, but instead of returningnilwhen the passed in value does not match the pattern it returns an exception/error object that containswhythe match failed.This would alleviate the current pain of finding the missing/wrong part of the input, without having to re-encode the expected structure in Malli/clojure.spec, etc.
Beta Was this translation helpful? Give feedback.
All reactions