Created
May 13, 2014 03:46
-
-
Save frenchy64/b8dd7d5cc458648a9515 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
(def init-aliases | |
'[ | |
^{:doc "A type that returns true for clojure.core/integer?" | |
:forms [AnyInteger]} | |
clojure.core.typed/AnyInteger (U Integer Long clojure.lang.BigInt BigInteger Short Byte) | |
^{:doc "A type that returns true for clojure.core/integer?" | |
:forms [Int]} | |
clojure.core.typed/Int (U Integer Long clojure.lang.BigInt BigInteger Short Byte) | |
^{:doc "A type that returns true for clojure.core/number?" | |
:forms [Num]} | |
clojure.core.typed/Num Number | |
^{:doc "A keyword" | |
:forms [Keyword]} | |
clojure.core.typed/Keyword clojure.lang.Keyword | |
; ^{:doc "A keyword" | |
; :forms [Kw]} | |
;clojure.core.typed/Kw clojure.lang.Keyword | |
^{:doc "A symbol" | |
:forms [Symbol]} | |
clojure.core.typed/Symbol clojure.lang.Symbol | |
; ^{:doc "A symbol" | |
; :forms [Sym]} | |
;clojure.core.typed/Sym clojure.lang.Symbol | |
^{:doc "A namespace" | |
:forms [Namespace]} | |
clojure.core.typed/Namespace clojure.lang.Namespace | |
^{:doc "An atom that can read and write type x." | |
:forms [(Atom1 t)]} | |
clojure.core.typed/Atom1 (TFn [[x :variance :invariant]] | |
(clojure.lang.Atom x x)) | |
^{:doc "An atom that can write type w and read type r." | |
:forms [(Atom2 t)]} | |
clojure.core.typed/Atom2 (TFn [[w :variance :contravariant] | |
[r :variance :covariant]] | |
(clojure.lang.Atom w r)) | |
^{:doc "An var that can read and write type x." | |
:forms [(Var1 t)]} | |
clojure.core.typed/Var1 | |
(TFn [[x :variance :invariant]] | |
(clojure.lang.Var x x)) | |
^{:doc "An var that can write type w and read type r." | |
:forms [(Var2 w r)]} | |
clojure.core.typed/Var2 | |
(TFn [[w :variance :contravariant] | |
[r :variance :covariant]] | |
(clojure.lang.Var w r)) | |
^{:doc "A ref that can read and write type x." | |
:forms [(Ref1 t)]} | |
clojure.core.typed/Ref1 (TFn [[x :variance :invariant]] (clojure.lang.Ref x x)) | |
^{:doc "A ref that can write type w and read type r." | |
:forms [(Ref2 w r)]} | |
clojure.core.typed/Ref2 (TFn [[w :variance :contravariant] | |
[r :variance :covariant]] | |
(clojure.lang.Ref w r)) | |
^{:doc "An agent that can read and write type x." | |
:forms [(Agent1 t)]} | |
clojure.core.typed/Agent1 (TFn [[x :variance :invariant]] | |
(clojure.lang.Agent x x)) | |
^{:doc "An agent that can write type w and read type r." | |
:forms [(Agent2 t t)]} | |
clojure.core.typed/Agent2 (TFn [[w :variance :contravariant] | |
[r :variance :covariant]] | |
(clojure.lang.Agent w r)) | |
^{:doc "A union of x and nil." | |
:forms [(Option t)]} | |
clojure.core.typed/Option (TFn [[x :variance :covariant]] (U nil x)) | |
^{:doc "A union of x and nil." | |
:forms [(Nilable t)]} | |
clojure.core.typed/Nilable (TFn [[x :variance :covariant]] (U nil x)) | |
^{:doc "The identity function at the type level." | |
:forms [Id]} | |
clojure.core.typed/Id (TFn [[x :variance :covariant]] x) | |
^{:doc "A persistent collection with member type x." | |
:forms [(Coll t)]} | |
clojure.core.typed/Coll (TFn [[x :variance :covariant]] | |
(clojure.lang.IPersistentCollection x)) | |
^{:doc "A persistent collection with member type x and count greater than 0." | |
:forms [(NonEmptyColl t)]} | |
clojure.core.typed/NonEmptyColl (TFn [[x :variance :covariant]] | |
(I (clojure.lang.IPersistentCollection x) (CountRange 1))) | |
^{:doc "A persistent vector with member type x." | |
:forms [(Vec t)]} | |
clojure.core.typed/Vec (TFn [[x :variance :covariant]] | |
(clojure.lang.IPersistentVector x)) | |
^{:doc "A persistent vector with member type x and count greater than 0." | |
:forms [(NonEmptyVec t)]} | |
clojure.core.typed/NonEmptyVec (TFn [[x :variance :covariant]] | |
(I (clojure.lang.IPersistentVector x) (CountRange 1))) | |
^{:doc "A non-empty lazy sequence of type t" | |
:forms [(NonEmptyLazySeq t)]} | |
clojure.core.typed/NonEmptyLazySeq (TFn [[t :variance :covariant]] | |
(I (clojure.lang.LazySeq t) (CountRange 1))) | |
^{:doc "A persistent map with keys k and vals v." | |
:forms [(Map t t)]} | |
clojure.core.typed/Map (TFn [[k :variance :covariant] | |
[v :variance :covariant]] | |
(clojure.lang.IPersistentMap k v)) | |
^{:doc "A persistent set with member type x" | |
:forms [(Set t)]} | |
clojure.core.typed/Set (TFn [[x :variance :covariant]] | |
(clojure.lang.IPersistentSet x)) | |
^{:doc "A sorted persistent set with member type x" | |
:forms [(SortedSet t)]} | |
clojure.core.typed/SortedSet (TFn [[x :variance :covariant]] | |
(Extends [(clojure.lang.IPersistentSet x) clojure.lang.Sorted])) | |
^{:doc "A type that can be used to create a sequence of member type x." | |
:forms [(Seqable t)]} | |
clojure.core.typed/Seqable (TFn [[x :variance :covariant]] | |
(clojure.lang.Seqable x))` | |
^{:doc "A type that can be used to create a sequence of member type x with count greater than 0." | |
:forms [(NonEmptySeqable t)]} | |
clojure.core.typed/NonEmptySeqable (TFn [[x :variance :covariant]] | |
(I (clojure.lang.Seqable x) (CountRange 1))) | |
^{:doc "A type that can be used to create a sequence of member type x | |
with count 0." | |
:forms [(EmptySeqable t)]} | |
clojure.core.typed/EmptySeqable (TFn [[x :variance :covariant]] | |
(I (clojure.lang.Seqable x) (ExactCount 0))) | |
^{:doc "A persistent sequence of member type x." | |
:forms [(Seq t)]} | |
clojure.core.typed/Seq (TFn [[x :variance :covariant]] | |
(clojure.lang.ISeq x)) | |
^{:doc "A persistent sequence of member type x with count greater than 0." | |
:forms [(NonEmptySeq t)]} | |
clojure.core.typed/NonEmptySeq (TFn [[x :variance :covariant]] | |
(I (clojure.lang.ISeq x) (CountRange 1))) | |
^{:doc "A persistent sequence of member type x with count greater than 0, or nil." | |
:forms [(NilableNonEmptySeq t)]} | |
clojure.core.typed/NilableNonEmptySeq (TFn [[x :variance :covariant]] | |
(U nil (I (clojure.lang.ISeq x) (CountRange 1)))) | |
^{:doc "The type of all things with count 0. Use as part of an intersection. | |
eg. See EmptySeqable." | |
:forms [EmptyCount]} | |
clojure.core.typed/EmptyCount (ExactCount 0) | |
^{:doc "The type of all things with count greater than 0. Use as part of an intersection. | |
eg. See NonEmptySeq" | |
:forms [NonEmptyCount]} | |
clojure.core.typed/NonEmptyCount (CountRange 1) | |
^{:doc "A hierarchy for use with derive, isa? etc." | |
:forms [Hierarchy]} | |
clojure.core.typed/Hierarchy '{:parents (clojure.lang.IPersistentMap Any Any) | |
:ancestors (clojure.lang.IPersistentMap Any Any) | |
:descendants (clojure.lang.IPersistentMap Any Any)} | |
^{:doc "A Clojure future (see clojure.core/{future-call,future})." | |
:forms [(Future t)]} | |
clojure.core.typed/Future | |
(TFn [[x :variance :covariant]] | |
(Extends [(clojure.lang.IDeref x) | |
(clojure.lang.IBlockingDeref x) | |
clojure.lang.IPending | |
java.util.concurrent.Future])) | |
^{:doc "A Clojure promise (see clojure.core/{promise,deliver})." | |
:forms [(Promise t)]} | |
clojure.core.typed/Promise | |
(TFn [[x :variance :invariant]] | |
(Rec [p] | |
(I (Extends [(clojure.lang.IDeref x) | |
(clojure.lang.IBlockingDeref x) | |
clojure.lang.IPending]) | |
[x -> (U nil p)]))) | |
^{:doc "A Clojure delay (see clojure.core/{delay,force})." | |
:forms [(Delay t)]} | |
clojure.core.typed/Delay | |
(TFn [[x :variance :covariant]] | |
(clojure.lang.Delay x)) | |
^{:doc "A Clojure derefable (see clojure.core/deref)." | |
:forms [(Deref t)]} | |
clojure.core.typed/Deref | |
(TFn [[x :variance :covariant]] | |
(clojure.lang.IDeref x)) | |
^{:doc "A Clojure blocking derefable (see clojure.core/deref)." | |
:forms [(BlockingDeref t)]} | |
clojure.core.typed/BlockingDeref | |
(TFn [[x :variance :covariant]] | |
(clojure.lang.IBlockingDeref x)) | |
^{:doc "A Clojure persistent list." | |
:forms [(List t)]} | |
clojure.core.typed/List | |
(TFn [[x :variance :covariant]] | |
(clojure.lang.IPersistentList x)) | |
^{:doc "A Clojure custom exception type." | |
:forms [ExInfo]} | |
clojure.core.typed/ExInfo | |
(I clojure.lang.IExceptionInfo | |
RuntimeException) | |
^{:doc "A Clojure proxy." | |
:forms [Proxy]} | |
clojure.core.typed/Proxy | |
clojure.lang.IProxy | |
; Should c.l.Sorted be parameterised? Is it immutable? | |
; ^{:doc "A sorted Clojure collection." | |
; :forms [Sorted]} | |
;clojure.core.typed/Sorted | |
; clojure.lang.Sorted | |
^{:doc "A Clojure stack." | |
:forms [(Stack t)]} | |
clojure.core.typed/Stack | |
(TFn [[x :variance :covariant]] | |
(clojure.lang.IPersistentStack x)) | |
^{:doc "A Clojure reversible collection." | |
:forms [(Reversible t)]} | |
clojure.core.typed/Reversible | |
(TFn [[x :variance :covariant]] | |
(clojure.lang.Reversible x)) | |
; TODO should this be parameterised? | |
; ^{:doc "A Clojure sequential collection." | |
; :forms [(Sequential t)]} | |
;clojure.core.typed/Sequential | |
; clojure.lang.Sequential | |
^{:doc "A Clojure multimethod." | |
:forms [Multi]} | |
clojure.core.typed/Multi | |
clojure.lang.MultiFn | |
]) |
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
user=> (def init-keys (map first (partition 2 init-aliases))) | |
#'user/init-keys | |
user=> (every? symbol? init-keys) | |
false | |
user=> (remove symbol? init-keys) | |
((clojure.core/with-meta (quote clojure.core.typed/NonEmptySeqable) (clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat (clojure.core/list :forms) (clojure.core/list (clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote user/NonEmptySeqable)) (clojure.core/list (quote user/t))))))))) (clojure.core/list :doc) (clojure.core/list "A type that can be used to create a sequence of member type x with count greater than 0.")))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment