How def/defns should be named?
There are two pretty obvious choices: file-path->*config-try-m seems too "wordy".
But file-name->*config Is ambiguous since it doesn't specify the context - just says that there is one.
I ended up using Orchestra for exception monad:
(defmacro exception-of?
"Construct predicate function for testing exception monad value.
The predicate returns true if the monad contains `exc/failure`
or if `exc/success` wraps value satisfying PRED predicate."
[pred]
`(fn [*val#]
(and (exc/exception? *val#)
(if (exc/success? *val#)
(m/bind *val# ~pred)
true))))
(defn-spec file-name->*config (exception-of? valid-config?)
[f-name file?]
...)
It should be better than adding "type" info into doc-string since the return value is validated by Orchestra's instrument so it won't go stale.
And Emacs doc thingy displays definition un-expanded so it's immediately apparent what kind of context is used.
But mb it's an overkill. 🤔
I haven't found any naming recommendation in the docs.
How
def/defns should be named?There are two pretty obvious choices:
file-path->*config-try-mseems too "wordy".But
file-name->*configIs ambiguous since it doesn't specify the context - just says that there is one.I ended up using Orchestra for exception monad:
It should be better than adding "type" info into doc-string since the return value is validated by Orchestra's
instrumentso it won't go stale.And Emacs doc thingy displays definition un-expanded so it's immediately apparent what kind of context is used.
But mb it's an overkill. 🤔
I haven't found any naming recommendation in the docs.