Fork me on GitHub
#clojure-spec
<
2017-03-30
>
cgrand14:03:04

Hi! Going meta: has anyone worked on generating (from a spec) the spec of it’s conformed data?

zane15:03:59

No, but I've thought about writing that function and would use the hell out of it.

alex.ter.weele18:03:49

on a related note, I’ve been wrestling with the "entry points” to spec. Once I learned that s/conform produces a new structure, e.g. when going through an s/or, I switched to using s/valid?. So what is the use case for s/conform? It sort of works like s/explain that produces an explanation on success too.

adambrosio19:03:38

@alex.ter.weele my main usage of conform has been in macros to parse the body in a way that I can emit things in a much simpler way

seancorfield20:03:27

@alex.ter.weele Producing a new, annotated data structure is really useful when your code needs to be able to branch on those or tags.

seancorfield20:03:10

For us (World Singles), we use conform to process our REST API inputs (all string values) and process keywords, numbers, dates, and strings -- with annotations around ranges of values etc.

cgrand20:03:14

@alex.ter.weele validate AND transform