Hi folks
I've released 0.1.0 of defn-spec
<https://github.com/danielcompton/defn-spec>, a library that lets you
define your function specs inline with your function definitions.
A quick example, defn-spec lets you write:
(ds/defn to-zoned-dt :- ::zoned-date-time
[instant :- ::instant
zone-id :- ::zone-id]
(ZonedDateTime/ofInstant instant zone-id))
instead of:
(defn to-zoned-dt
[instant zone-id]
(ZonedDateTime/ofInstant instant zone-id))
(s/fdef to-zoned-dt
:args (s/cat :instant ::instant :zone-id ::zone-id)
:ret ::zoned-date-time)
If you're thinking "that looks a lot like Schema's defn macro", then you'd
be right. defn-spec uses the same syntax and much of the implementation of
Schema's defn macro.
I wrote more background in the announcement post
<https://danielcompton.net/2019/03/31/announcing-defn-spec>, and there are
more details on GitHub <https://github.com/danielcompton/defn-spec>. I hope
you find it useful!
Thanks, Daniel.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.