clojure-australia 2021-05-03

Morning all πŸ‘‹ Spent a couple hours yesterday retrofitting schema’s defn macro to work with malli instead

πŸ‘‹ 1

Basically yeah. Although it also attaches pre/post maps validating those types when checking is on

Reading schema's docs (Ive not used it before) :- seems to be just for type hints, is that right?

Oh right. How did you go about instrumenting with malli? (Assuming you do)

Not specifically instrumenting. So spec has its instrument for replacing a function with a version with the fdef applied. Schema's version is to declare it on the defn itself with some optional symbol :- type syntax, then switch it on with a global var

There's also a switch for not allowing compilation at all, so it just adds the raw defn without any checking (basically elide asserts)

Plus it constructs the equivalent of fdef while you're at it

Mind sharing how? Im curious because Im starting to play around with malli myself. Also, what are your thoughts on spec 2?

Grabbed the schema macros and modified them to use malli instead

That's honestly it πŸ˜‚

Was actually fairly painless, just a bit of thinking

As for spec2, I've only glanced at it but I'm still not sold

Putting things in a registry and needing a separate fdef, both make it harder to read things

Morning folks πŸ‘‹