Created
September 8, 2013 06:31
-
-
Save anonymous/6482420 to your computer and use it in GitHub Desktop.
CTYP-49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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