Fork me on GitHub
#malli
<
2021-07-23
>
robert-stuttaford13:07:32

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

borkdude17:07:19

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

borkdude17:07:42

we have an issue here: https://github.com/babashka/babashka/discussions/906 to consider including it

borkdude17:07:43

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

borkdude17:07:09

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

robert-stuttaford15:07:43

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?

ikitommi15:07:31

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

ikitommi11:07:46

doc PRs always welcome

ikitommi15:07:43

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?]]]]}}
   "hiccup"])

(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