Skip to content

nyiyui/hm_inference_example

Repository files navigation

Hindley-Milner Type Inference Example with Algorithm W

This repo contains an interpreter for a toy language based on simply-typed lambda calculus. It is designed to be a practical illustration of how Algorithm W works in OCaml code.

Most of the code (e.g. parser, type checker) is contained in /lib, with /lib/type_check.ml being the type inference/checking code, /lib/parser.mly containing parser definitions, etc.

Instructions to Build and Run

This project uses Dune to build and run tests.

There are a couple of options to get Dune:

  • If you already have Nix, you can run nix develop in the root directory of this repo. That will install Dune with required OPAM packages.
  • You can install Dune and the required OPAM packages manually, following the normal Dune documentation.

Instructions to Run the Web Version

Run python3 -m http.serever --bind 127.0.0.1 in the root directory and open http://localhost:8000 in your browser.

About

Example implementation of Hindley-Milner's type system with Algorithm W

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published