Instantly share code, notes, and snippets.

anonymous /ctyp_49.core.clj
Created Sep 8, 2013

What would you like to do?
(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))))]
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
(defproject ctyp-49 "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url ""
:license {:name "Eclipse Public License"
:url ""}
:repositories {"sonatype-oss-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"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment