Fork me on GitHub

does #malli work with #babashka ? (just did a demo for my team and our infra human is curious)


malli currently doesn't work (from source) in babashka


we have an issue here: to consider including it


@U0509NKGK there are alternatives which currently work, such as spartan.spec (a spec drop-in replacement) and minimallist


if you could tell me how exactly malli would be useful for infra, please discuss in the issue, it could be an argument to include it


truly just pure curiosity at this point 🙂

Ben Sless14:07:58

Is there a reason :ref schemas just die for regex parsing? Why do they have to be surrounded by :maybe?


you can wrap anything in :schema to push it outside of the sequence.

Ben Sless16:07:19

It would be good to add in the readme that recursive seqexp reference schemas have to have another level of indirection via either maybe or schema


doc PRs always welcome


Here's an example with hiccup, which is recursive:

(def Hiccup
  [:schema {:registry {"hiccup" [:orn
                                 [:node [:catn
                                         [:name keyword?]
                                         [:props [:? [:map-of keyword? any?]]]
                                         [:children [:* [:schema [:ref "hiccup"]]]]]]
                                 [:primitive [:orn
                                              [:nil nil?]
                                              [:boolean boolean?]
                                              [:number number?]
                                              [:text string?]]]]}}

(def parse-hiccup (m/parser Hiccup))

Ben Sless15:07:27

I'll try. I got the parser working besides ref which I just hacked around for now

Ben Sless16:07:30

Updated the gist with working version, next step is a dynamic interpreter, followed by a compiler. It's pretty cool I can use the library to define new syntax. It extends itself

🥳 3