Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inst and uuid have strange behaviour in malli/provide #103

Closed
boxxxie opened this issue Oct 30, 2019 · 1 comment
Closed

inst and uuid have strange behaviour in malli/provide #103

boxxxie opened this issue Oct 30, 2019 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@boxxxie
Copy link

boxxxie commented Oct 30, 2019

(mp/provide
 {
  #uuid "db0d64d2-f9c2-11e9-a9c8-4e1c82be3afd" {:key 'value}
  #uuid "db0d62d2-f9c2-11e9-a9c8-4e1c82be3afd" {:key 'value}
  })
;; => [:vector [:or uuid? [:map [:key symbol?]]]]

(mp/provide
 {:test
  {
   #uuid "db0d64d2-f9c2-11e9-a9c8-4e1c82be3afd" {:key 'value}
   #uuid "db0d62d2-f9c2-11e9-a9c8-4e1c82be3afd" {:key 'value}
   }})
;; => [:vector
;;     [:or
;;      keyword?
;;      [:map
;;       [#uuid "db0d64d2-f9c2-11e9-a9c8-4e1c82be3afd" [:map [:key symbol?]]]
;;       [#uuid "db0d62d2-f9c2-11e9-a9c8-4e1c82be3afd" [:map [:key symbol?]]]]]]

(mp/provide
 {
  #inst "2000-01-01" {:key 'value}
  #inst "2001-01-01" {:key 'value}
  })
;; => [:vector [:or inst? [:map [:key symbol?]]]]

(mp/provide
 {:test
  {
   #inst "2000-01-01" {:key 'value}
   #inst "2001-01-01" {:key 'value}
   }})
;; => [:vector
;;     [:or
;;      keyword?
;;      [:map
;;       [#inst "2000-01-01T00:00:00.000-00:00" [:map [:key symbol?]]]
;;       [#inst "2001-01-01T00:00:00.000-00:00" [:map [:key symbol?]]]]]]

sometimes keys on maps are inferred correctly, and sometimes the inference in a pass-through

@ikitommi
Copy link
Member

The mp/provide expects a sequence of values.

(mp/provide
  [{#uuid "db0d64d2-f9c2-11e9-a9c8-4e1c82be3afd" {:key 'value}
    #uuid "db0d62d2-f9c2-11e9-a9c8-4e1c82be3afd" {:key 'value}}])
; [:map
;  [#uuid"db0d64d2-f9c2-11e9-a9c8-4e1c82be3afd" [:map [:key symbol?]]]
;  [#uuid"db0d62d2-f9c2-11e9-a9c8-4e1c82be3afd" [:map [:key symbol?]]]]

this is expected, as there is no support yet for inferring :map-of, see #74 .

@ikitommi ikitommi added the duplicate This issue or pull request already exists label Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants