Fork me on GitHub
#malli
<
2021-02-08
>
Kevin07:02:07

How do you spec a function? e.g. I'd like to do this:

[:map
 [:component/foo 'fn?]]

Kevin07:02:30

But that results in :malli.core/invalid-schema {:schema fn?}

ikitommi07:02:23

@kevin.van.rooijen you can say: [:map [:component/foo [:fn fn?]] or 'fn? to keep it serializable

ikitommi07:02:19

my code sniplet from yesterday show how one can enforce input & output params and arities too.

Kevin07:02:00

Cool, [:fn 'fn] works like a charm

Kevin07:02:20

Thanks, looking forward to the next release 🙂 Will be replacing all my specs with Malli once that happens

ikitommi13:02:06

nice. would be great if some non-metosinian blogged about the goods and bads of spec, schema and malli - from real life experience. happy to try fix all the bads in malli 😉

Kevin20:02:35

I might do that eventually, although I have a hard time thinking of bad things about Malli, so it'll probably only be success stories 🙂

Kevin20:02:10

I'm currently using it for Gungnir, and working on integrating it for Duct / some web development stuff. At my job we heavily use Malli as well (As well as serialized through an API)

Kevin20:02:29

I might use the new parser for a (hiccup) templating language that I'm building. So that's pretty cool timing of the new feature 😄