newbie - How to annotate multiarity functions?

11 views
Skip to first unread message

Colin Yates

unread,
Mar 9, 2015, 3:47:46 PM3/9/15
to clojure-c...@googlegroups.com
If I have:

(t/defn a 
  ([] :- String (a "me"))
  ([name :- String] :- String (str "Hello " name)))

then when I check namespace it claims 'a' isn't annotated. I tried to do the external parity but couldn't get that to work:

(t/ann a [-> String] [String -> String])


Ambrose Bonnaire-Sergeant

unread,
Mar 9, 2015, 4:05:10 PM3/9/15
to core.typed
(t/ann a (t/Fn [-> String] [String -> String]) is what you want.

Colin Yates

unread,
Mar 9, 2015, 4:08:55 PM3/9/15
to clojure-c...@googlegroups.com
Thanks Ambrose - I have just found your PDF from
https://s3.amazonaws.com/github/downloads/frenchy64/papers/ambrose-honours.pdf
and it is answering a lot of questions that I didn't get from the
github page - is it worth linking there?

On 9 March 2015 at 20:04, Ambrose Bonnaire-Sergeant
Reply all
Reply to author
Forward
0 new messages