Created
May 27, 2014 07:51
-
-
Save txrev319/90a59a65824092177947 to your computer and use it in GitHub Desktop.
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 cljs.core.typed | |
"Macros for Clojurescript type checking" | |
(:refer-clojure :exclude [type defprotocol #_letfn fn loop dotimes let for doseq | |
#_def #_filter #_remove]) | |
(:require [clojure.core.typed :as t] | |
[clojure.core.typed.current-impl :as impl :refer [v]] | |
[clojure.core.typed.util-cljs :as u] | |
[cljs.analyzer :as ana] | |
[cljs.compiler :as comp] | |
[cljs.core :as core] | |
[cljs.env :as env] | |
[clojure.pprint :as pprint])) | |
; many of these macros resolve to CLJS functions in | |
; the CLJS ns cljs.core.typed | |
(defmacro ann-form [form ty] form) | |
(defmacro ann [varsym typesyn] varsym) | |
(defmacro defalias [& args] nil) | |
(defn bindings--strip-types [lst] | |
(apply vector | |
(map second | |
(filter (core/fn [[a b]] | |
(and (not= a :-) | |
(not= b :-))) | |
(map vector (cons nil lst) lst))))) | |
(defmacro def [v tag typ & rst] | |
(concat ['def v] | |
rst)) | |
(defmacro defn> [nm tag typ bindings & rst] | |
(concat ['defn nm (bindings--strip-types bindings)] | |
rst)) | |
(defmacro doseq [bindings & rst] | |
(concat ['cljs.core/doseq] | |
[(bindings--strip-types bindings)] | |
rst)) | |
(defmacro for [bindings & rst] | |
(concat ['cljs.core/for] | |
[(bindings--strip-types bindings)] | |
rst)) | |
(defmacro let [bindings & rst] | |
(concat ['cljs.core/let] | |
[(bindings--strip-types bindings)] | |
rst)) | |
(defmacro fn [bindings tag type & rst] | |
(concat ['cljs.core/fn] | |
[(bindings--strip-types bindings)] | |
rst)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment