This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-06
Channels
- # announcements (3)
- # asami (41)
- # aws (2)
- # babashka (65)
- # beginners (85)
- # biff (7)
- # calva (10)
- # cider (5)
- # cljsrn (32)
- # clojure (6)
- # clojure-czech (3)
- # clojure-europe (10)
- # clojure-russia (4)
- # clojure-uk (3)
- # clojurescript (5)
- # core-typed (7)
- # data-science (13)
- # datomic (43)
- # etaoin (4)
- # fulcro (22)
- # graphql (3)
- # gratitude (1)
- # helix (1)
- # joyride (2)
- # liquid (10)
- # malli (16)
- # off-topic (10)
- # other-languages (1)
- # polylith (10)
- # reitit (3)
- # scittle (7)
- # shadow-cljs (103)
- # tools-deps (10)
- # vim (9)
- # xtdb (2)
Hello hello!
Is there a generics implemented in malli in some way? I was thinking maybe e.g. [:generic=> [:n-type number?] [:cat :n-type] [:vector :n-type]]
, :generic=>
taking a vector of pairs of keywords and schemas and then the usual :=>
args
All clojure functions are generic, lol
the idea is to parse malli schemas to ts type definitions
to make cljs libraries nicer to consume from ts
Sorry, I replied with a cheeky comment but I meant to follow up: clojure inherently doesn't have generics and while I don't want to speak for the metosin folks, i suspect that the concept of "generics" fundamentally doesn't align with schema systems like malli. you can already achieve generics by just using :or
and normal clojure functions: [:or (mapv #(do [:=> [:cat %] [:vector %]]) [number? keyword? string?])]
having said that, iwould be interested to see what you could build in this space as i think it has potential. it's cool to see the overlap between clojure schema systems and typescript's structural typing
very nice
malli positively surprising me as usual
thank you all for the excellent work!
I'm developing mali-ts
as a way to integrate malli schemas into typescript's type system and it'd be really good to have generics, though I understand why in clojure it might not make so much sense
Maybe it's not even that hard to implement? I'm not sure
And on the topic typescript integration, it'd be really good to have a way to model Promise
s and async stuff
If doesn't make sense to have those in malli
, I might implement in malli-ts
only