Skip to content

About

Common Lisp type system: type inference and checking, extracted from cl-cc

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

cl-cc-type

CI License: MIT Documentation

The type system of the cl-cc Common Lisp compiler, as a standalone SBCL system: kinds, multiplicity, Hindley–Milner inference with rank-N and bidirectional checking, type classes, algebraic effects, row polymorphism, subtyping, and typecase exhaustiveness checking. Everything is exported from the cl-cc/type package. Its one org-internal dependency is cl-cc-ast, used through its public API for the AST nodes that inference walks.

Full documentation is published at https://nerima-lisp.github.io/cl-cc-type/. The source for that site lives in docs/src/.

Quick Start

(asdf:load-system "cl-cc-type")

(let* ((var (cl-cc/type:fresh-type-var :name 'a))
       (arrow (cl-cc/type:parse-type-specifier '(function (integer) string))))
  (multiple-value-bind (subst ok) (cl-cc/type:type-unify var arrow)
    (and ok (cl-cc/type:unparse-type (cl-cc/type:apply-unification var subst)))))
;; => (-> FIXNUM STRING)

Install

# flake.nix
inputs.cl-cc-type = {
  url = "github:nerima-lisp/cl-cc-type/v0.2.0";
  flake = false;
};

Note the pinned tag. Consumers inside this org must pin a release tag rather than follow the default branch. See Installation for the cl-cc-ast side of the setup and for the non-Nix path.

Documentation

Development

nix develop          # SBCL with CL_SOURCE_REGISTRY already set
nix run .#test       # run the test suite
nix flake check      # tests + formatting + docs + paredit lint, the same gate CI uses
nix fmt              # format Nix sources (treefmt)
nix build .#coverage # SB-COVER report (result/cover-index.html)

Tests live in t/ and run under cl-weave, the org's test framework. Six test files from the monorepo are absent because they need the compiler's not-yet-extracted parse stage; see Development for which and why.

Contributing

See the org-wide CONTRIBUTING guide and the package standard.

Support

See SUPPORT.

License

MIT. See LICENSE.

About

Common Lisp type system: type inference and checking, extracted from cl-cc

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages