I'm a bit rusty with spec. Is there a "trick" to get generators working across s/and? I think I get why it must behave like this, and can think of a few ways to do this but not sure the best or if there's some built-in shortcut in the generators library. Or is it better just to keep s/keys specs "top level" when possible?
(s/def ::x string?)
(s/def ::y keyword?)
(s/def ::a (s/keys :req [::x]))
(s/def ::b (s/keys :req [::y]))
(s/exercise ::a) ;;works
(s/exercise ::b) ;;works
(s/exercise (s/and ::a ::b)) ;;ExceptionInfo Couldn't satisfy such-that predicate after 100 tries.I believe you want https://clojuredocs.org/clojure.spec.alpha/merge
Ah yes perfect, thanks!
yes, merge is what you want here