I really like HHmap and its friends in TypedClojure. Has anyone thought of a run time check similar to Malli for TypedClojure? If TypedClojure could do malli/assert style assertions and generate data, I would never use anything.
There's some existing work.
• Here's a library that converts types to Malli schemas so you can use malli operators with HMap's https://github.com/typedclojure/typedclojure/blob/main/typed/malli/README.md#validation
• here's a namespace that converts types to generators https://github.com/typedclojure/typedclojure/blob/main/typed/malli/src/typed/malli/generator.clj
• clojure.core.typed/{pred,cast} are ways to generate assertions based on types, but I'm probably concentrating on Malli conversion from now on https://github.com/typedclojure/typedclojure/blob/4edaa0d63bb8ed9b93fa38e97bbd77f14256b39d/typed/clj.runtime/src/clojure/core/typed.cljc#L869-L919
👁️
This is very cool, thanks for sharing. Is org.typedclojure/typed.malli the future of this type of stuff in TypedClojure?
mostly yes. There's some things that are inexpressible in malli at the moment like polymorphic types. but the dream is that there's a one-to-one conversion to a malli schema for all types, and we can simply leverage that ecosystem for dynamic checking, Typed Clojure adding the one thing malli doesn't do, which is static checking.
malli is also flexible enough that we can create our own suite of schemas, e.g., a :typed.clojure/HMap schema.
I've attempted for several years to encode t/All as a schema but haven't nailed it yet.
This is very cool thanks for sharing. We have a medium to large code base at shortcut. ~250k lines. We have started to use malli, but I would love to have something more like typedcojure.
oh cool
maybe the lowest hanging fruit it to try and use malli syntax to provide types, and report any bugs you find https://github.com/typedclojure/typedclojure/tree/main/example-projects/malli-type-providers
I used Claude to add many of the remaining conversions of core schemas to types https://github.com/typedclojure/typedclojure/commit/95709b3abb92389341154518be69ff2311b11a05
it's nice to now have schemas for t/Seqable (I contributed them to malli recently)
(:seqable :every) `(t/Seqable ~(gen-inner (first (m/children m))))