• This repository has been archived on 02/Jan/2018
  • Stars
    star
    208
  • Rank 185,218 (Top 4 %)
  • Language
    Clojure
  • License
    Eclipse Public Li...
  • Created over 12 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED SEE BELOW Gradual typing for Clojure

This repository has moved: core.typed

Leiningen dependency (Clojars):

[typed "0.1.6"]

Typed Clojure

Gradual typing in Clojure, as a library.

[Talk] Clojure Conj 2012

Video

Documentation

See wiki.

License

Typed Clojure is released under the same license as Clojure: Eclipse Public License v 1.0.

See LICENSE.

Changelog

0.1.6

  • Ensure Result is not introduced when performing type inference on drest fn apps

  • tc-ignore is more do-like.

    Workaround for a quirk in the Clojure compiler where protocols only get generated in a top-level do.

  (identity (do (def-protocol foo (bar [this]))
              bar)) ;; <-- bar cannot be resolved
  vs.
  (do (def-protocol foo (bar [this]))
    bar)  ;; <-- bar is resolvable

(patch by Stephen Compall, issue #3)

  • Fix typo in into-array logic (patch by Stephen Compall, issue #4)
  • into-array> generalises Java types, does not need redundant type annotations. See User Documentation in wiki.
  • Improve type of clojure.core/class. (class ) is always a Class (class nil) is always a nil
  • Move documentation to wiki.

0.1.5

  • Better errors for Java methods and polymorphic function applications, borrow error messages from Typed Racket
  • Change ann-datatype, ann-protocol, ann-pprotocol syntax to be flatter (ann-protocol pname method-name method-type ...) (ann-dataype dname [field-name :- field-type ...])
  • Add defprotocol>

0.1.4

  • Support Clojure 1.4.0+
  • Better errors, print macro-expanded form from AST

0.1.3

  • Refactor typed.core into individual files
  • Add method-type
    • (method-type 'java.io.File/getName) prints the current Typed Clojure type for the getName method of File
  • Add types for some clojure.core coersion functions
  • Preliminary support for ClojureScript

0.1.2

  • Fix objects and filters being lost during polymorphic and dotted function applications
    • Add tests for (if (seq a) (first a) 0) filter example.
  • Can annotate datatypes outside current namespace
  • Improve type of seq, next, conj
  • tc-pr-env -> print-env
  • tc-pr-filters -> print-filterset
  • Alter APersistentMap
  • Check that local binding occurrences match with expected types
  • Heterogeneous maps are APersistentMap's instead of IPersistentMap's
  • Heterogeneous vectors are APersistentVector's instead of IPersistentVector's

0.1.1

  • Ensure ann-form finally checks its expression is of the expected type
  • Improve simplifying of intersections involving Java classes

Quickstart

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

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

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

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

Examples

(These don't completely type check yet)

Future work

  • Equality filters for occurrence typing
  • Type check multimethods
  • Rest type checking in fn definition
  • Type check defprotocol definitions
  • Unify AST with ClojureScript
  • Namespace dependency management

Contributors

Stephen Compall (S11001001)

More Repositories

1

Logic-Starter

Starter Project for Introduction to Logic Programming with Clojure
Clojure
220
star
2

dynalint

Lint your Clojure programs as they run
Clojure
72
star
3

analyze

Interface to Clojure's Analyzer
Clojure
70
star
4

fully-satisfies

Utility functions for Clojure.
Clojure
47
star
5

optimized-kw-maps

Exploration of Hash Array Mapped Tries.
TeX
38
star
6

typed-clojurescript-play

Playground for Typed Clojurescript
Clojure
20
star
7

typescript-parser

TypeScript type declaration parser
TypeScript
9
star
8

stream-fusion

Racket
9
star
9

dependabot-lein-via-mvn

Only slightly janky dependabot support for Leiningen
Shell
8
star
10

dependabot-clojure-cli-via-mvn

Only slightly janky dependabot support for Clojure CLI
Shell
6
star
11

dissertation

TeX
5
star
12

lein-dynalint

Leiningen plugin for Dynalint
Clojure
5
star
13

clojure-local-dev

A pull-request based workflow for developing and submitting Clojure patches to Jira.
Shell
5
star
14

spec-play

Clojure
4
star
15

lti-model

Clojure
4
star
16

stl2014

Code examples for Strangeloop 2014 Typed Clojure in Practice
Clojure
4
star
17

compose-talk-2019

HTML
3
star
18

contract.typed

Boston Clojure Group presentation
Clojure
2
star
19

c-project-template

Template for a C project that uses Valgrind, a small unit testing framework and a small debugging framework.
C
2
star
20

thesis-proposal

TeX
2
star
21

criterium-from-java

Use Clojure's criterium benchmarking library from other JVM languages
Java
2
star
22

instrument-defprotocol

Utilities to wrap defprotocol.
Clojure
2
star
23

toronto-2014

Clojure
1
star
24

bench-update

Clojure
1
star
25

papers

TeX
1
star
26

ambrosebs-reaper-scripts

Lua
1
star
27

dynamic-inference-bib

1
star