{"id":13672489,"url":"https://github.com/lazear/types-and-programming-languages","last_synced_at":"2026-01-28T12:19:52.200Z","repository":{"id":54702503,"uuid":"182344493","full_name":"lazear/types-and-programming-languages","owner":"lazear","description":"Exercises from Benjamin Pierce's \"Types and Programming Languages\" textbook + extras!","archived":false,"fork":false,"pushed_at":"2020-07-26T23:17:31.000Z","size":581,"stargazers_count":182,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T21:35:21.591Z","etag":null,"topics":["lambda-calculus","programming-languages","tapl","type-theory","types","types-and-programming-languages"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lazear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-20T01:17:46.000Z","updated_at":"2024-05-17T03:29:25.000Z","dependencies_parsed_at":"2022-08-14T00:30:58.517Z","dependency_job_id":null,"html_url":"https://github.com/lazear/types-and-programming-languages","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazear%2Ftypes-and-programming-languages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazear%2Ftypes-and-programming-languages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazear%2Ftypes-and-programming-languages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazear%2Ftypes-and-programming-languages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lazear","download_url":"https://codeload.github.com/lazear/types-and-programming-languages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219601,"owners_count":21554444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lambda-calculus","programming-languages","tapl","type-theory","types","types-and-programming-languages"],"created_at":"2024-08-02T09:01:37.078Z","updated_at":"2026-01-28T12:19:52.133Z","avatar_url":"https://github.com/lazear.png","language":"Rust","readme":"# types-and-programming-languages\n\n![](https://github.com/lazear/types-and-programming-languages/workflows/Rust/badge.svg)\n\nSeveral Rust implementations of exercises from Benjamin Pierce's \"Types and Programming Languages\" are organized into different folders, as described below:\n\n- `arith` is an implementation of the untyped lambda calculus extended with simple numeric operations\n\n- `lambda` is an implementation of the untyped lambda calculus as presented in chapter 5, 6, and 7.\n\n- `typedarith` is the `arith` project extended with simple types: `Nat` and `Bool`\n\n- `stlc` is an implementation of the simply typed lambda calculus, as discussed in chapters 9 and 10 of TAPL. This simply typed calculus has the types, `Unit`, `Nat`, `Bool`, `T -\u003e T` (arrow), and `Record` types.\n\n- `recon` contains several implementations of Hindley-Milner based type reconstruction from the untyped lambda calculus to System F, with let-polymorphism. Both Algorithm W (the more common) and Algorithm J (the more efficient) are presented. For Alg. W, both a naive equality constraint solver, and a faster union-find (with path compression) solver are provided. Algorithm J makes use shared mutable references to promote type sharing instead.\n\n- `system_f` contains a parser, typechecker, and evaluator for the simply typed lambda calculus with parametric polymorphism (System F). The implementation of System F is the most complete so far, and I've tried to write a parser, typechecker and diagnostic system that can given meaningful messages\n\n- `system_fw` contains a parser for a high-level, Standard ML like source language that is desugared into an HIR, and then System F-omega. This extends `system_f` with type operators and higher-kinded types. This is where most of the ongoing work is located, as I'd like to make this the basis of a toy (but powerful, and useable) programming language. Ideally we will have some form of bidirectional type inference. Work on this has accidentally turned into a full fledged [SML compiler](https://github.com/SomewhatML/sml-compiler), so it's likely that I will roll back the work on the system_fw project to just type checking\n\n- `bidir` is is an implementation of the bidirectional typechecker from 'Complete and Easy Bidirectional Typechecking', extended with booleans, product, and sum types. I make no claims on the correctness of the implementation for the extended features not present in the paper.\n\n- `dependent` is WIP, implementing a simple, dependently typed lambda calculus as discussed in ATAPL.\n\n","funding_links":[],"categories":["Books code","Rust"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazear%2Ftypes-and-programming-languages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazear%2Ftypes-and-programming-languages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazear%2Ftypes-and-programming-languages/lists"}