Skip to content

Commit

Permalink
Fix typing errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
pashields committed Mar 25, 2014
1 parent ff1466b commit 341108e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/core.typed "0.2.39"]]
[org.clojure/core.typed "0.2.40"]]
:core.typed {:check [graf-znak.accumulators
graf-znak.hooks
graf-znak.atom-storage
Expand Down
9 changes: 4 additions & 5 deletions src/graf_znak/accumulators.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns graf-znak.accumulators
"Contains the accumulator record and types as well as pre-built instances."
(:require [clojure.core.typed :refer :all])
(:require [clojure.core.typed :refer :all]
[graf-znak.annotations :refer :all])
(:import [java.util.concurrent.atomic AtomicLong]))

;; Accumulator
Expand Down Expand Up @@ -65,9 +66,7 @@
[state :- Any
input :- input-type]
(let [vals (map #(get input %) fields)]
;; As of this writing pred requires fully qualified symbols if check-ns
;; is called from another namespace. blech.
(assert ((pred (clojure.core.typed/Set (clojure.core.typed/Coll Any))) state))
(assert ((pred (Set (Coll Any))) state))
(if (not-any? nil? vals)
(conj state (apply hash-map (interleave fields vals)))
(conj state (zipmap fields vals))
state)))))
11 changes: 11 additions & 0 deletions src/graf_znak/annotations.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ns graf-znak.annotations
"Contains extra annotations of non graf-znak functions."
(:require [clojure.core.typed :refer :all]))

(ann ^:no-check clojure.core/not-any? (Fn [(Fn [Any -> Boolean]) (Seq Any)
-> Boolean]))
(ann ^:no-check clojure.core.reducers/map
(All [x y]
(Fn [(Fn [x -> Any]) (Seq x) -> (Seq Any)])))
(ann ^:no-check clojure.core.reducers/filter
(Fn [(Fn [Any -> Boolean]) (Seq Any) -> (Seq Any)]))
12 changes: 2 additions & 10 deletions src/graf_znak/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
(:require [clojure.core.typed :refer :all]
[clojure.core.reducers :as r]
[graf-znak.hooks :refer :all]
[graf-znak.accumulators :refer :all]))
[graf-znak.accumulators :refer :all]
[graf-znak.annotations :refer :all]))

;; Type aliases
(def-alias hooks-type (Seq hook-type))
(def-alias state-type (Map hook-type
HookStorage))

;; Annotations
(ann ^:no-check clojure.core/not-any? (Fn [(Fn [Any -> Boolean]) (Seq Any)
-> Boolean]))
(ann ^:no-check clojure.core.reducers/map
(All [x y]
(Fn [(Fn [x -> Any]) (Seq x) -> (Seq Any)])))
(ann ^:no-check clojure.core.reducers/filter
(Fn [(Fn [Any -> Boolean]) (Seq Any) -> (Seq Any)]))

(defn> process-hook
"Processes a single input for all accumulators in a hook."
:- Any
Expand Down

0 comments on commit 341108e

Please sign in to comment.