Skip to content

Instantly share code, notes, and snippets.

Created September 8, 2013 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6482420 to your computer and use it in GitHub Desktop.
Save anonymous/6482420 to your computer and use it in GitHub Desktop.
CTYP-49
(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))
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 "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"]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment