Skip to content

Commit

Permalink
format & update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Jan 7, 2024
1 parent 3ebd6c4 commit 147977f
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 77 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/clojure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Java ${{ matrix.jdk }}
uses: actions/setup-java@v3.12.0
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jdk }}
Expand All @@ -42,9 +42,9 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Java 11
uses: actions/setup-java@v3.12.0
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
Expand All @@ -54,7 +54,7 @@ jobs:
with:
cli: latest
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
uses: actions/setup-node@v4.0.1
with:
node-version: 16
- name: Install dependencies
Expand All @@ -67,9 +67,9 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Java 11
uses: actions/setup-java@v3.12.0
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
Expand Down
4 changes: 2 additions & 2 deletions app/malli/app.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
(:require [malli.core :as m]))

(m/validate
[:map [:maybe [:maybe :string]]]
{:maybe "sheep"})
[:map [:maybe [:maybe :string]]]
{:maybe "sheep"})
; => true
10 changes: 5 additions & 5 deletions app/malli/app2.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
:map (m/-map-schema)})

(m/validate
[:map [:maybe [:maybe :string]]]
{:maybe "sheep"}
{:registry registry})
[:map [:maybe [:maybe :string]]]
{:maybe "sheep"}
{:registry registry})
; => true

(mr/set-default-registry! registry)

(m/validate
[:map [:maybe [:maybe :string]]]
{:maybe "sheep"})
[:map [:maybe [:maybe :string]]]
{:maybe "sheep"})
; => true
4 changes: 2 additions & 2 deletions app/malli/dev_preload.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns malli.dev-preload
{:dev/always true}
(:require
[malli.instrument-app]
[malli.dev.cljs :as dev]))
[malli.instrument-app]
[malli.dev.cljs :as dev]))

(dev/start!)
18 changes: 6 additions & 12 deletions app/malli/helpers2.cljs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
(ns malli.helpers2
(:require
[malli.experimental :as mx]
[malli.core :as m]
[malli.helpers :as h :refer [int-schema]]))
[malli.experimental :as mx]
[malli.core :as m]
[malli.helpers :as h :refer [int-schema]]))

(mx/defn square-it :- h/int-schema
[x :- int?]
(str x)
;(str (* x x))
)


;(mx/defn f1 [] 1)
;(mx/defn f3 [x :- :int] x)
;(mx/defn f4 :- [:int {:min 0}]
Expand All @@ -21,7 +19,6 @@
(def AB [:map [:a [:int {:min 0}]] [:b :int]])
(def CD [:map [:c [:int {:min 0}]] [:d :int]])


;; schematized, nested keywords args
(mx/defn f5 :- [:cat :int :int :int :int AB CD]
"Nested Keyword argument"
Expand All @@ -32,16 +29,13 @@
(mx/defn f3 [x :- :int] x)
(comment
(macroexpand
'(mx/defn f3 [x :- :int] x)
)
'(mx/defn f3 [x :- :int] x))
(macroexpand
'(mx/defn f5 :- [:cat :int :int :int :int AB CD]
'(mx/defn f5 :- [:cat :int :int :int :int AB CD]
"Nested Keyword argument"
[[& {:keys [a b] :as m1} :- AB]
& {:keys [c d] :as m2} :- CD]
[a b c d m1 m2])
)
)
[a b c d m1 m2])))

;(defn square-it [x] (* x x))
;(m/=> square-it [:=> [:cat h/int-schema] int-schema])
Expand Down
63 changes: 27 additions & 36 deletions app/malli/instrument_app.cljs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
(ns malli.instrument-app
(:require
[malli.instrument :as mi-new]
malli.helpers
[malli.core :as m]
[clojure.test.check.generators :as gen]
[malli.experimental.time.generator]
[malli.dev.pretty :as pretty]
[malli.generator :as mg]
[malli.experimental :as mx]
[malli.experimental.time :as time]))
[malli.instrument :as mi-new]
malli.helpers
[malli.core :as m]
[clojure.test.check.generators :as gen]
[malli.experimental.time.generator]
[malli.dev.pretty :as pretty]
[malli.generator :as mg]
[malli.experimental :as mx]
[malli.experimental.time :as time]))

(js/console.log "now: " (time/LocalDate.now))
(js/console.log "generated: "
(gen/sample (mg/-schema-generator (time/-local-date-time-schema) nil) 10))
(gen/sample (mg/-schema-generator (time/-local-date-time-schema) nil) 10))

(js/console.log
(into-array
(mg/sample :time/zoned-date-time {:registry (merge (m/default-schemas) (time/schemas))})))
(into-array
(mg/sample :time/zoned-date-time {:registry (merge (m/default-schemas) (time/schemas))})))

(mx/defn my-ex-fn :- [:int]
[a :- :string] (+ 5 a))
Expand All @@ -34,20 +34,19 @@
;(defn add-dates [a b]
; {:malli/schema [:=> [:cat :time/local-date :time/local-date] :time/local-date]}


(defn sum [a b] (+ a b))

(def sum2
(m/-instrument {:schema (m/schema [:=> [:cat :int :int] :int])
:report (pretty/reporter)}
sum))
sum))

;(m/=> sum [:=> [:cat :int :int] :int])

(set! sum
(m/-instrument {:schema (m/schema [:=> [:cat :int :int] :int])
:report (pretty/reporter)}
sum))
(m/-instrument {:schema (m/schema [:=> [:cat :int :int] :int])
:report (pretty/reporter)}
sum))

(defn minus
"a normal clojure function, no dependencies to malli"
Expand All @@ -57,7 +56,6 @@
[x]
(dec x))


(defn plus-gen
;{:malli/schema [:=> [:cat :int] [:int {:min 6}]]}
[x]
Expand All @@ -67,7 +65,6 @@
; @mi/instrumented-vars
; ((get @mi/instrumented-vars `sum) 1 "2"))


(defn plus1 [a] (inc a))
;(m/=> plus1 [:=> [:cat :int] :int])

Expand Down Expand Up @@ -98,10 +95,10 @@

(def pow-gen
(m/-instrument
{:schema [:function
[:=> [:cat :int] [:int {:max 6}]]
[:=> [:cat :int :int] [:int {:max 6}]]]
:gen mg/generate}))
{:schema [:function
[:=> [:cat :int] [:int {:max 6}]]
[:=> [:cat :int :int] [:int {:max 6}]]]
:gen mg/generate}))

(defn minus2
"kukka"
Expand All @@ -120,7 +117,6 @@

(m/=> sum3 [:=> [:cat :int :int] :int])


(def small-int [:int {:max 6}])

(def MyInt (m/-simple-schema {:type 'MyInt, :pred #(and (int? %) (< 100 %))}))
Expand All @@ -142,11 +138,11 @@

(defn multi-arity-variadic-fn
{:malli/schema
[:function
[:function
;[:=> [:cat] [:int]]
[:=> [:cat :int] [:int]]
[:=> [:cat :string :string] [:string]]
[:=> [:cat :string :string :string [:* :string]] [:string]]]}
[:=> [:cat :int] [:int]]
[:=> [:cat :string :string] [:string]]
[:=> [:cat :string :string :string [:* :string]] [:string]]]}
([] 500)
([a] (inc a))
([a b] (str a b))
Expand Down Expand Up @@ -182,11 +178,8 @@
;; fails as it hits the last fn schema
(multi-arity-variadic-fn 'a "b" "b")
;(multi-arity-variadic-fn "a" "b" "c" :x)

)

(macroexpand '(mi-new/collect! {:ns ['malli.instrument-app 'malli.instrument-test 'malli.instrument.fn-schemas
]}))
(macroexpand '(mi-new/collect! {:ns ['malli.instrument-app 'malli.instrument-test 'malli.instrument.fn-schemas]}))
(defn ^:dev/after-load x []
(println "AFTER LOAD - malli.dev.cljs/start!")
;(m/-deregister-metadata-function-schemas! :cljs)
Expand All @@ -212,15 +205,13 @@
;(mi.old/instrument!)
;(js/setTimeout try-it 100)
)


(comment
(macroexpand
'(dev/start!))
'(dev/start!))
(m/function)
(@(Var. (constantly str-join) 'str-join {:metadata 'here}) [1 2])
(= (Var. (constantly str-join) `str-join {:metadata 'here})
#'str-join)
#'str-join)
(macroexpand '(dev/collect-all!))

(macroexpand '(mi-new/collect-all!))
Expand Down
25 changes: 12 additions & 13 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
mvxcvi/arrangement {:mvn/version "2.1.0"}}
:aliases {:test {:extra-paths ["test"]
:extra-deps {com.gfredericks/test.chuck {:mvn/version "0.2.14"}
lambdaisland/kaocha {:mvn/version "1.86.1355"}
lambdaisland/kaocha {:mvn/version "1.87.1366"}
lambdaisland/kaocha-cljs {:mvn/version "1.5.154"}
org.babashka/sci {:mvn/version "0.8.40"}
org.babashka/sci {:mvn/version "0.8.41"}
lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"}
metosin/spec-tools {:mvn/version "0.10.6"}
spec-provider/spec-provider {:mvn/version "0.4.14"}
metosin/schema-tools {:mvn/version "0.13.1"}
metosin/jsonista {:mvn/version "0.3.7"}
metosin/jsonista {:mvn/version "0.3.8"}
prismatic/schema {:mvn/version "1.4.1"}
minimallist/minimallist {:mvn/version "0.0.10"}
net.cgrand/seqexp {:mvn/version "0.6.2"}
djblue/portal {:mvn/version "0.46.0"}
djblue/portal {:mvn/version "0.51.0"}
meta-merge/meta-merge {:mvn/version "1.0.0"}
expound/expound {:mvn/version "0.9.0"}
lambdaisland/deep-diff {:mvn/version "0.0-47"}
com.bhauman/spell-spec {:mvn/version "0.1.2"}
org.clojure/spec-alpha2 {:git/url "https://github.com/clojure/spec-alpha2.git"
:sha "4cbfa677c4cd66339f18e1c122222c05c69e0d8e"}}}
:sci {:extra-deps {org.babashka/sci {:mvn/version "0.8.40"}}}
:cherry {:extra-deps {io.github.squint-cljs/cherry {:git/sha "24635085f3a268e624dee5f6b7ec049323a01173"}}}
:sci {:extra-deps {org.babashka/sci {:mvn/version "0.8.41"}}}
:cherry {:extra-deps {io.github.squint-cljs/cherry {:git/sha "21ec3e33d7cc5df88ba75bbb563522f843e846fd"}}}
:test-sci {:extra-paths ["test-sci"]
:main-opts ["-m" "cljs-test-runner.main" "-d" "test-sci" "-d" "test"]}
:test-cherry {:extra-paths ["test-cherry"]
Expand All @@ -37,7 +37,7 @@
com.widdindustries/cljs.java-time {:mvn/version "0.1.20"}}
:extra-paths ["test" "cljs-test-runner-out/gen"]
:main-opts ["-m" "cljs-test-runner.main" "-d" "test"]}
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.9.5" :git/sha "24f2894"}}
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.9.6" :git/sha "8e78bcc"}}
:ns-default build}
:jmh {:paths ["target/uber.jar" "classes"]
:deps {jmh-clojure/jmh-clojure {:mvn/version "0.4.1"}
Expand All @@ -49,7 +49,7 @@
org.clojure/tools.namespace #_:clj-kondo/ignore {:mvn/version "RELEASE"}}}

:shadow {:extra-paths ["app"]
:extra-deps {thheller/shadow-cljs {:mvn/version "2.25.3"}
:extra-deps {thheller/shadow-cljs {:mvn/version "2.26.2"}
binaryage/devtools {:mvn/version "1.0.7"}}}
:slow {:extra-deps {io.dominic/slow-namespace-clj
{:git/url "https://git.sr.ht/~severeoverfl0w/slow-namespace-clj"
Expand All @@ -60,7 +60,7 @@
:sha "b093f79420fef019faf62a75b888b5e10f4e8cc9"}}
:main-opts ["-m" "mach.pack.alpha.skinny" "--no-libs"
"--project-path" "malli.jar"]}
:deploy {:extra-deps {slipset/deps-deploy {:mvn/version "0.2.1"}}
:deploy {:extra-deps {slipset/deps-deploy {:mvn/version "0.2.2"}}
:exec-fn deps-deploy.deps-deploy/deploy
:exec-args {:installer :remote
:artifact "malli.jar"}}
Expand All @@ -69,12 +69,11 @@
"malli.jar"]}
:graalvm {:extra-paths ["graal-test/src"]
:extra-deps {org.clojure/clojure {:mvn/version "1.11.1"}
org.babashka/sci {:mvn/version "0.8.40"}}}
org.babashka/sci {:mvn/version "0.8.41"}}}
:perf {:extra-paths ["perf"]
:extra-deps {criterium/criterium {:mvn/version "0.4.6"}
org.clojure/clojure {:mvn/version "1.11.1"}
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.5"}}
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.1.1"}}
:jvm-opts ["-server"
"-Xmx4096m"
"-Dclojure.compiler.direct-linking=true"]}
:clojure-11 {}}}
"-Dclojure.compiler.direct-linking=true"]}}}

0 comments on commit 147977f

Please sign in to comment.