malli

https://github.com/metosin/malli :malli:
ikitommi 2021-04-14T04:27:23.429400Z

@qythium looks like a bug in parsing entries.

ikitommi 2021-04-14T04:27:40.429700Z

weird thing that haven’t bumped into it before.

Setzer22 2021-04-14T08:27:59.431900Z

I was wondering, is there dedicated support in function schemas to handle things like (fn [a, b, & {:keys [c, d]}) I'd like to be able to do: (m/=> fn-name [:=> [:cat Foo, Bar, [:map?? [:c Baz] [:d Other]]]]

Setzer22 2021-04-14T08:29:26.432900Z

I couldn't find something to put in place of :map?? in my example

nilern 2021-04-14T09:08:07.435Z

I don't think so You could do [:cat Foo, Bar, [:* [:alt [:cat [:= :c] :any] [:cat [:= :d] :any]]]] (permits duplicates, but so does the fn itself)

nilern 2021-04-14T09:10:27.435900Z

It would be good to have something more convenient especially with Clojure 1.11: https://clojure.org/news/2021/03/18/apis-serving-people-and-programs

nilern 2021-04-14T09:13:09.438Z

Like [:cat Foo, Bar, [:alt [:* [:alt [:cat [:= :c] :any] [:cat [:= :d] :any]]] [:map [:c {:optional true} :any] [:d {:optional true} :any]]] or something can handle the 1.11 feature as well but who likes to write it even once

nilern 2021-04-14T09:18:07.439600Z

You could write your own utility fn to generate that but really it should be built in to the fn schemas somehow

ikitommi 2021-04-14T09:19:33.440100Z

maybe: [:cat Foo, Bar, [:& [:c Baz] [:d Other]]]?

nilern 2021-04-14T09:27:52.441300Z

But it does not do normal varargs so :& could be confusing. :&n?

2021-04-14T12:20:57.441500Z

I've made some questions asking about Intrument impl

2021-04-14T12:21:09.441700Z

what malli expects for it

ikitommi 2021-04-14T13:11:49.441900Z

noticed, thanks! need to think it over before answering.

1