Public Vars

Back

munge (clj)

(source)

function

(munge s)

Examples

clojure/core.typed
(ns clojure.core.typed.test.repl-new
  (:require [clojure.core.typed :as t]
            [clojure.test :refer :all]                
            [clojure.core.typed.test.test-utils :refer :all]))

(deftest apropos-test
  (is-tc-e #(apropos "clojure") [-> (Seq Sym)]
             :requires [[clojure.repl :refer [apropos]]])
  (is-tc-e #(apropos #"") [-> (Seq Sym)]
             :requires [[clojure.repl :refer [apropos]]])
  (is-tc-err #(apropos "clojure") [-> (Seq String)]
             :requires [[clojure.repl :refer [apropos]]])
  (is-tc-err #(apropos 'clojure) [-> (Seq Str)]
             :requires [[clojure.repl :refer [apropos]]]))
             
(deftest demunge-test
  (is-tc-e #(demunge "clojure.repl$demunge") [-> Str]
           :requires [[clojure.repl :refer [demunge]]])
  (is-tc-err #(demunge "clojure.repl$demunge") [-> (Vec Any)]
             :requires [[clojure.repl :refer [demunge]]])
  (is-tc-err #(demunge 'clojure.repl$demunge) [-> Str]
             :requires [[clojure.repl :refer [demunge]]]))
             
(deftest source-fn-test
  (is-tc-e #(source-fn 'source) [-> (U nil Str)]
           :requires [[clojure.repl :refer [source-fn]]])
  (is-tc-err #(source-fn 'source) [-> (Vec Any)]
             :requires [[clojure.repl :refer [source-fn]]])
  (is-tc-err #(source-fn "source") [-> Str]
             :requires [[clojure.repl :refer [source-fn]]]))
clojure/core.typed
(ns clojure.core.typed.test.mainnew
  (:require  [clojure.core.typed :as t] 
             [clojure.test :refer :all]                
             [clojure.core.typed.test.test-utils :refer :all]))

(deftest demunge-test
  (is-tc-e (demunge "abc") String 
           :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge "abc") Boolean
             :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge 1) String 
             :requires [[clojure.main :refer [demunge]]]))
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

cc/munge (t/IFn [t/Sym :-> t/Sym]
                [t/Str :-> t/Str]
                [t/Any :-> (t/U t/Sym t/Str)])

cc/prefer-method [t/Multi t/Any t/Any :-> t/Any]
#?@(:cljs [] :default [
cc/print-simple [t/Any java.io.Writer :-> nil]
cc/char-escape-string (t/Map Character t/Str)
cc/char-name-string (t/Map Character t/Str)
cc/primitives-classnames (t/Map Class t/Str)
cc/namespace-munge [(t/U t/Sym t/Namespace) :-> t/Str]
;cc/find-protocol-impl ['{:on-interface Class
;                                   :impls ?}]

#?@(:cljs [] :default [
clojure.repl/apropos [(t/U t/Str t/Regex) :-> (t/Seq t/Sym)]
clojure.repl/demunge [t/Str :-> t/Str]
clojure.repl/source-fn [t/Sym :-> (t/U t/Str nil)]
])

#?@(:cljs [] :default [
clojure.main/demunge [t/Str :-> t/Str]
clojure.main/repl-prompt [:-> t/Any]
clojure.main/repl-read [t/Any t/Any :-> t/Any]
clojure.main/repl-caught [Throwable :-> t/Any]
clojure.main/repl-exception [Throwable :-> t/Any]
clojure.main/root-cause [Throwable :-> Exception]
clojure.main/repl [& :optional {:init [:-> t/Any]
                                :need-prompt [:-> t/Any]
                                :prompt [:-> t/Any]
                                :flush [:-> t/Any]
                                :read [t/Any t/Any :-> t/Any]
                                :eval [t/Any :-> t/Any]
                                :print [t/Any :-> t/Any]
                                :caught [Throwable :-> t/Any]}
                   :-> t/Any]
clojure.main/main [t/Any :* :-> t/Any]
clojure.main/load-script [t/Str :-> t/Any]
])