Hi guys, Does anyone know how to properly deal with refs in core.typed? I am running into trouble. When I try to do stuff like this:
(ann my-ref (Ref1 (U Kw nil))) > (def my-ref (ref #{})) I get this error: > IllegalArgumentException No value supplied for key: true > clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77) the only thing I can do to make it work is ^:no-check it, but is this the solution? Furthermore, when check this code here: (defn update-refs [ref-name :- (Ref1 (Set (Option Kw))), update-map :- > (Map Kw String)] :- (Set (Option Kw)) > (dosync > (alter some-other-ref merge update-map) > (alter ref-name s/union #{(first (keys update-map))}))) I get errors about how alter is unable to be applied to its arguments and how first is a polymorphic function. Here they are in all their glory. I can't follow the the thread of what exactly is wrong here from what it says. Type Error (tic_tac_toe/check.clj:80:3) Polymorphic function alter could not be applied to arguments: Polymorphic Variables: w r b Domains: (Ref2 w r) [r b ... b -> w] b ... b Arguments: (Ref1 (HMap :mandatory {:a2 (Option Str), :b2 (Option Str), :c3 (Option Str), :a3 (Option Str), :a1 (Option Str), :b1 (Option Str), :c2 (Option Str), :c1 (Option Str), :b3 (Option Str)})) (All [k v] (IFn [nil * -> nil] [(clojure.lang.IPersistentMap k v) (clojure.lang.IPersistentMap k v) * -> (clojure.lang.IPersistentMap k v)] [(Option (clojure.lang.IPersistentMap k v)) * -> (Option (clojure.lang.IPersistentMap k v))])) (Map Kw java.lang.String) Ranges: w in: (alter some-other-ref merge update-map) in: (alter some-other-ref merge update-map) Type Error (tic_tac_toe/check.clj:81:4) Polymorphic function alter could not be applied to arguments: Polymorphic Variables: w r b Domains: (Ref2 w r) [r b ... b -> w] b ... b Arguments: (Ref1 (Set (Option Kw))) (All [x] [(Set x) * -> (Set x)]) (PersistentHashSet (U Keyword nil)) Ranges: w with expected type: Any in: (alter my-ref s/union #{(first (keys update-map))}) in: (alter my-ref s/union #{(first (keys update-map))}) Type Error (tic_tac_toe/check.clj:79:3) Polymorphic static method clojure.lang.LockingTransaction/runInTransaction could not be applied to arguments: Polymorphic Variables: x Domains: [-> x] Arguments: [-> Any] Ranges: x with expected type: (Set (Option Kw)) in: (clojure.lang.LockingTransaction/runInTransaction (fn* ([] (do (alter some-other-ref merge update-map) (alter my-ref s/union #{(first (keys update-map))}))))) in: (clojure.lang.LockingTransaction/runInTransaction (fn* ([] (do # #)))) Lastly, the example from the wiki with the atom: (cf (atom {}) (Atom1 (Map Sym Num))) => (Atom2 (IPersistentMap Sym Num) (IPersistentMap Sym Num)) does not translate to the ref: (cf (ref #{}) (Ref1 (Seq (U nil Kw)))) => IllegalArgumentException No value supplied for key: true > clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77) (same error as above) I have seen this error before on a jira issue posted here: http://dev.clojure.org/jira/browse/CLJ-1149 What is going on? I am using clojure 1.7.0-alpha4 and core.typed 0.2.72 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.