File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed
Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change 11^:kindly/hide-code
2- ^{:clay {:title " Eelements of Malli"
2+ ^{:clay {:title " Elements of Malli"
33 :quarto {:type :post
44 :author [:bsless ]
55 :date " 2025-10-18"
@@ -714,6 +714,45 @@ inferred
714714
715715; ; # Function Schemas
716716
717+ ; ; ```clojure
718+ ; ; (defn square [x] (* x x))
719+ ; ; (m/=> square [:=> [:cat int?] nat-int?])
720+ ; ;
721+ ; ; (defn plus
722+ ; ; ([x] x)
723+ ; ; ([x y] (+ x y)))
724+ ; ;
725+ ; ; (m/=> plus [:function
726+ ; ; [:=> [:cat int?] int?]
727+ ; ; [:=> [:cat int? int?] int?]])
728+ ; ;
729+ ; ; (defn plus1
730+ ; ; "Adds one to the number"
731+ ; ; {:malli/schema [:=> [:cat :int] :int]}
732+ ; ; [x] (inc x))
733+ ; ; ```
734+
735+ ; ; These, or inline annotations, can be used to emit clj-kondo configurations or instrument live functions
736+
737+ ; ; #### emit clj-kondo configurations
738+
739+ ; ; ```clojure
740+ ; ; (require '[malli.clj-kondo :as mc])
741+ ; ; (mc/emit!)
742+ ; ; ```
743+
744+ ; ; #### Instrument functions
745+
746+ ; ; To instrument and report functions:
747+ ; ; (require '[malli.dev :as dev])
748+ ; ; (require '[malli.dev.pretty :as pretty])
749+ ; ; (dev/start! {:report (pretty/reporter)})
750+
751+ ; ; to only instrument functions, for instances such as test time:
752+ ; ; ```clojure
753+ ; ; (require '[malli.instrument :as mi])
754+ ; ; ```
755+
717756; ; # Custom Schemas
718757
719758; ; ## Case study - URL schema
You can’t perform that action at this time.
0 commit comments