public
anonymous / ctyp_49.core.clj
Created

CTYP-49

  • Download Gist
ctyp_49.core.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12
(ns ctyp-49.core
(:require [clojure.core.typed :as t]
[org.httpkit.client :as http]))
(t/ann org.httpkit.client/request ['{:url String :method (Value :get)} -> (t/Atom1 '{:status Number :body String})])
(t/ann get-or-throw [String -> '{:status Number :body String}])
(defn get-or-throw [url]
(let [doc (http/request {:url url :method :get})
doc @doc
_ (if (not= (:status doc) 200) (throw (Exception. (str "Got bad status: " doc))))]
doc))
lein check.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14
ambrose@ambrose-VirtualBox:~/Projects/temp/ctyp-49$ lein typed check
Initializing core.typed ...
Loading Clojurescript...
Clojurescript not found
"Elapsed time: 5410.294045 msecs"
core.typed initialized.
Start collecting ctyp-49.core
Finished collecting ctyp-49.core
Collected 1 namespaces in 6376.95601 msecs
Start checking ctyp-49.core
Checked ctyp-49.core in 455.848161 msecs
WARNING: Type Checker: Definition missing: org.httpkit.client/request
Hint: Use :no-check metadata with ann if this is an unchecked var
Checked 1 namespaces (approx. 12 lines) in 6839.186825 msecs
project.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
(defproject ctyp-49 "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}
:dependencies [[org.clojure/clojure "1.5.1"]
[http-kit "2.1.10"]
[enlive "1.1.4"]
[com.novemberain/monger "1.5.0"]
[org.clojure/data.priority-map "0.0.2"]
[org.clojure/core.typed "0.2.5-20130907.143145-5"]
;[org.clojure/core.typed "0.2.4"]
]
:plugins [[lein-typed "0.3.0"]]
:core.typed {:check [ctyp-49.core]}
; "lein typed check"
:jvm-opts ^:replace ["-Xmx1g" "-server"]
)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.