Beginners question on how to use core.typed

39 views
Skip to first unread message

Roger Gilliar

unread,
Dec 28, 2014, 1:49:16 PM12/28/14
to clojure-c...@googlegroups.com
I just starting with core.typed and what I'm trying to do is to provide the simplest type annotations possible.

(t/ann make-keyword [t/Keyword t/Keyword -> t/Keyword])
(defn- make-enum [prefix kw]
  (when-not prefix (throw (Exception. "prefix must not be nil")))
  (when-not kw (throw (Exception. "kw must not be nil")))
  (keyword (str (name prefix) "/" (name kw))))

But that gives me ?

Type Error (project/vertices/impl/persistence_impl.clj:19:3) Function name could not be applied to arguments:

Domains:
(t/U clojure.lang.Named java.lang.String)

Arguments:
t/Any

Ranges:
java.lang.String

in: (name prefix)
in: (keyword (str (name prefix) / (name kw)))


Type Error (project/vertices/impl/persistence_impl.clj:19:3) Function name could not be applied to arguments:


Domains:
(t/U clojure.lang.Named java.lang.String)

Arguments:
t/Any

Ranges:
java.lang.String

in: (name kw)
in: (keyword (str (name prefix) / (name kw)))

Ambrose Bonnaire-Sergeant

unread,
Dec 28, 2014, 1:59:13 PM12/28/14
to core.typed
It looks like the annotation and defn have different names.

Roger Gilliar

unread,
Dec 28, 2014, 2:15:19 PM12/28/14
to clojure-c...@googlegroups.com
Oh, just as copy/paste error.

thanks. 

Roger

Reply all
Reply to author
Forward
0 new messages