[ANN] Automatic Clojure Type Annotations

43 views
Skip to first unread message

Ambrose Bonnaire-Sergeant

unread,
Aug 14, 2016, 10:33:33 AM8/14/16
to clojure, core.typed
Hi,

Happy to announce a new open-source Clojure tool
to generate core.typed type annotations from tests. It's part of a
new crowdfunding campaign I'm running, read on for details!

# What is it?

This tool infers top-level annotations by instrumenting
your code, running tests, and finally inserts inferred
annotations directly in your source code.

Here's a quick gif demonstrating the tool.

You can read more about the ideas behind the tool here.

# Prototype: Write Tests, Get Types!

The latest core.typed release contains a
prototype for Automatic Annotation inference.

Try it out here!

# Crowdfunding

I am running a crowdfunding campaign to support
Automatic Annotations for Typed Clojure. The money
will help me keep working on Typed Clojure and travel
to industry conferences.

I will be writing more about how this tool works, and
the general applicability of the infrastructure its
based on. 

For example:
- clojure.spec generative tests can help generate type annotations, and
- the infrastructure could even be repurposed to generate clojure.spec specs!
- mutually recursive map structures can be inferred
- ideas for polymorphic inference

There are only 7 days left and we need $7,500 to
reach our goal. Please help by contributing!

Thanks for your support!
Ambrose

Ambrose Bonnaire-Sergeant

unread,
Aug 17, 2016, 2:13:53 PM8/17/16
to clojure, core.typed
Here's a demo of generating clojure.spec specs + Typed Clojure types
for functions and macros.


Thanks for your support!
Ambrose

Leon Grapenthin

unread,
Aug 17, 2016, 5:14:47 PM8/17/16
to Clojure, clojure-c...@googlegroups.com, abonnair...@gmail.com
Wow. I can imagine this saving a day or two when trying to type or spec a legacy codebase.

Wouldn't it also be / Is it possible to infer deeper calling levels?

I. e. if (defn f [x] (g x)) generate types/specs for g and f from (f 42)?

Because when one doesn't have unit tests, she could gain exponentially more types/specs from only calling some top level functions with constants.

Thank you for doing this and kind regards, Leon.

Ambrose Bonnaire-Sergeant

unread,
Aug 17, 2016, 10:11:26 PM8/17/16
to core. typed
Thanks Leon!

In fact, untyped libraries are already inferred. See this and this post.

Jeroen van Dijk

unread,
Aug 18, 2016, 4:39:45 AM8/18/16
to clojure-c...@googlegroups.com
Hi Ambrose,

We, AdGoji, want to make a contribution to your campaign as a company. The GoGo things seems to be tied to a person, or did I miss something?

Thanks,
Jeroen

Ambrose Bonnaire-Sergeant

unread,
Aug 18, 2016, 11:06:28 AM8/18/16
to core. typed

Hi Jeroen,

I'm not attached to a company, if that's what you mean. The contributions via indiegogo will be sent directly to me.

Thanks,
Ambrose

Jeroen van Dijk

unread,
Aug 18, 2016, 11:26:16 AM8/18/16
to clojure-c...@googlegroups.com
Hi Ambrose,

No sorry I mean AdGoji/the company wants to contribute to you, but the Indiegogo seems to be for a specific person to make the contribution. I.e. I would like to fill in the company name there. What do you advise?

Thanks,
Jeroen

Jeroen van Dijk

unread,
Aug 18, 2016, 11:34:42 AM8/18/16
to clojure-c...@googlegroups.com
Ok I figured it doesn't matter. I've filled it in anyway.

Cheers,
Jeroen 
Reply all
Reply to author
Forward
0 new messages