GithubHelp home page GithubHelp logo

core.typed's Introduction

core.typed

Optional typing in Clojure, as a library.

Releases and Dependency Information

Latest stable release is 0.3.23.

Leiningen dependency information:

[org.clojure/core.typed "0.3.23"]

...
; for very recent releases
:repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}

; for slim jars, follow version string with: :classifier "slim"

Maven dependency information:

<dependency>
  <groupId>org.clojure</groupId>
  <artifactId>core.typed</artifactId>
  <version>0.3.23</version>
  <!-- slim jar -->
  <!-- <classifier>slim</classifier> -->
</dependency>

The default jars contain AOT files for faster loading. If jar size is a concern, consider using the slim jar in production.

Compatibility

core.typed supports Clojure 1.8.0 and JDK 1.7+.

Getting started

Tldr; here is a complete project using core.typed.

With the core.typed JAR in your classpath, run the following code to enable automatic type checking. This is how to start with Leiningen.

:injections [(require 'clojure.core.typed)
             (clojure.core.typed/install)])

Next add the following ns metadata to the file you are working with.

(ns test.core
  {:lang :core.typed})

Save the file and run (require 'test.core :reload). This should type check the file automatically.

It's useful to also import clojure.core.typed to annotate expressions.

(ns test.core
  {:lang :core.typed}
  (:require [clojure.core.typed :as t]))

(t/ann f [t/Any :-> t/Int])
(defn f [x]
  (t/cast t/Int x))

Expressions evaluated via eval will also be type checked if the following is true at runtime: (= :core.typed (:lang (meta *ns*))).

[Talk] Clojure Conj 2012

Video

Mailing List and IRC

Use the core.typed mailing list for core.typed discussion, or try #typed-clojure on Freenode (the main developer is ambrosebs).

IRC Logs (Thanks to Anthony Grimes!)

Documentation

See wiki.

API Reference

Ambrose's blog

Leiningen Plugin

lein-typed

Vim Plugin

vim-typedclojure

Quickstart

(clojure.core.typed/ann v t) gives var v the static type t.

(clojure.core.typed/ann-form f t) ensures form f is of the static type t.

(clojure.core.typed/check-ns) type checks the current namespace.

(clojure.core.typed/cf t) type checks the form t.

Examples

core.async Rock-paper-scissors

ClojureScript Checker

The ClojureScript checker has not followed the last year of upstream changes, so it does not work. If you would like to help update the checker, please post on the mailing list.

Developer Information

Contributors

Thanks to the following people for contributing to core.typed:

  • Stephen Compall (S11001001)
  • Andrew Brehaut (brehaut)
  • Christopher Spencer (cspencer)
  • Reid McKenzie (arrdem)
  • Di Xu (xudifsd)
  • Nicola Mometto (Bronsa)
  • Chas Emerick (cemerick)
  • Jake Goulding (shepmaster)
  • Andy Fingerhut
  • Aravind K N (arav93)
  • Allen Rohner (arohner)
  • Minori Yamashita (ympbyc)
  • Kyle Kingsbury (aphyr)
  • Nathan Sorenson
  • Tobias Kortkamp (t6)
  • Alejandro Gomez (dialelo)
  • Piotr Jarzemski (kazuhiro)

Sponsors

Development is sponsored (via crowdfunding) by

YourKit

YourKit is kindly supporting core.typed and other open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products:

License

Copyright © Ambrose Bonnaire-Sergeant, Rich Hickey & contributors.

Licensed under the EPL (see the file epl.html).

core.typed's People

Contributors

frenchy64 avatar ympbyc avatar shepmaster avatar c-spencer avatar xudifsd avatar arrdem avatar aphyr avatar jafingerhut avatar arohner avatar cemerick avatar takeoutweight avatar brehaut avatar bronsa avatar kazuhiro avatar s11001001 avatar arav93 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.