Created
April 24, 2017 00:45
-
-
Save olivergeorge/45339f8d5b4c3eda9ccf12387cd4a917 to your computer and use it in GitHub Desktop.
Quick hacky example of using https://github.com/stathissideris/spec-provider to infer types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def example-data (atom {:args #{} :ret #{}})) | |
(defn record-example [k v] | |
(js/console.debug ::record-example [k v]) | |
(swap! example-data update k conj v) | |
v) | |
(s/fdef dsl/build-model | |
:args (partial record-example :args) | |
:ret (partial record-example :ret)) | |
(comment | |
(->> @example-data :args count) | |
(->> @example-data :args (map first) count) | |
(->> @example-data :args (map first) first) | |
(spec-provider.provider/pprint-specs | |
(spec-provider.provider/infer-specs | |
(->> @example-data :args (map first) (take 5)) | |
::model-spec) | |
'toy | |
's) | |
(->> @example-data :args (map first) (map :field-spec) (mapcat vals) (take 5)) | |
(spec-provider.provider/pprint-specs | |
(spec-provider.provider/infer-specs | |
(->> @example-data :args (map first) (map :field-spec) (mapcat vals)) | |
::field-spec-map) | |
'toy | |
's)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment