Skip to content

Commit c6aed8e

Browse files
Merge pull request #108 from bsless/bsless-elements-of-malli
Typo fix and function schemas
2 parents 0080e75 + dc0ab41 commit c6aed8e

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

src/malli/elements_of_malli.clj

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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

0 commit comments

Comments
 (0)