├── .github └── workflows │ └── build.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Setup.hs ├── app └── Main.hs ├── flake.lock ├── flake.nix ├── frontend ├── .gitignore ├── .vitepress │ ├── config.mts │ └── theme │ │ ├── index.ts │ │ └── style.css ├── index.md ├── package-lock.json ├── package.json ├── playground.md ├── postcss.config.js ├── quick-reference.md ├── research.md └── tailwind.config.js ├── package.yaml ├── src ├── Alg.hs ├── Alg │ ├── DK.hs │ ├── DK │ │ ├── Common.hs │ │ ├── DK.hs │ │ ├── Worklist.hs │ │ └── Worklist │ │ │ ├── Bounded.hs │ │ │ ├── Common.hs │ │ │ ├── DK.hs │ │ │ ├── Elementary.hs │ │ │ └── IU.hs │ ├── HDM.hs │ ├── HDM │ │ ├── AlgR.hs │ │ └── AlgW.hs │ ├── Local.hs │ └── Local │ │ ├── Contextual.hs │ │ ├── Contextual │ │ └── Contextual.hs │ │ └── Local.hs ├── Lib.hs ├── Opt.hs ├── Parser.hs ├── Print.hs └── Syntax.hs ├── stack.yaml ├── stack.yaml.lock ├── test └── Spec.hs └── type-inference-zoo.cabal /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build the static website 2 | on: 3 | push: 4 | branches: 5 | - main 6 | 7 | jobs: 8 | build: 9 | name: Build the static website 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v4 15 | 16 | - name: Install Nix 17 | uses: cachix/install-nix-action@v30 18 | with: 19 | nix_path: nixpkgs=channel:nixos-unstable 20 | 21 | - name: Install GHC-wasm and build 22 | working-directory: . 23 | run: nix develop --command bash -c "wasm32-wasi-cabal update && wasm32-wasi-cabal build" 24 | 25 | - name: Install Node.js 26 | uses: actions/setup-node@v4 27 | with: 28 | node-version: "22.11" 29 | 30 | - name: Compile frontend 31 | working-directory: ./frontend 32 | run: | 33 | npm install 34 | npm run docs:build 35 | 36 | - name: Prepare website 37 | run: | 38 | cp -r frontend/.vitepress/dist site 39 | cp ./dist-newstyle/build/wasm32-wasi/ghc-*/type-inference-zoo-0.1.0.0/x/type-inference-zoo-exe/build/type-inference-zoo-exe/type-inference-zoo-exe.wasm site/bin.wasm 40 | 41 | - name: Upload Artifact for GitHub Pages 42 | uses: actions/upload-pages-artifact@v3 43 | with: 44 | path: site/ 45 | 46 | deploy: 47 | needs: build 48 | 49 | # Grant GITHUB_TOKEN the permissions required to make a Pages deployment 50 | permissions: 51 | pages: write # to deploy to Pages 52 | id-token: write # to verify the deployment originates from an appropriate source 53 | 54 | # Deploy to the github-pages environment 55 | environment: 56 | name: github-pages 57 | url: ${{ steps.deployment.outputs.page_url }} 58 | 59 | # Specify runner + deployment step 60 | runs-on: ubuntu-latest 61 | steps: 62 | - name: Deploy to GitHub Pages 63 | id: deployment 64 | uses: actions/deploy-pages@v4 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist-newstyle/ 2 | .stack-work/ 3 | *~ 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for `type-inference-zoo` 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to the 7 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 8 | 9 | ## Unreleased 10 | 11 | ## 0.1.0.0 - YYYY-MM-DD 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2025 Chen Cui 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Type Inference Zoo 2 | 3 | ![Build Status](https://github.com/cu1ch3n/type-inference-zoo/actions/workflows/build.yml/badge.svg) 4 | ![License](https://img.shields.io/badge/license-MIT-blue.svg) 5 | 6 | 7 | Welcome to **Type Inference Zoo**! This project is dedicated to implementing a variety of type inference algorithms. It serves as a personal project, as I am trying to understand the type inference algorithms well by implmenting them. Considering that it might be helpful for those who are also exploring type inference algoreithms, I am glad to make them avaliable online. 8 | 9 | 🗿🗿🗿 There are indeed animals (**implementations**) in the zoo, not only references to animals. 10 | 11 | A static online web demo is available for you to try at https://zoo.cuichen.cc/. 12 | 13 | ## 🚀 Get Started 14 | 15 | To get started with the project, clone the repository and build the project using [`stack`](https://docs.haskellstack.org/): 16 | 17 | ```bash 18 | git clone https://github.com/cu1ch3n/type-inference-zoo.git 19 | cd type-inference-zoo 20 | stack build 21 | stack exec type-inference-zoo-exe -- "let id = \x. x in (id 1, id True)" --alg W 22 | ``` 23 | 24 | ## Research Works Implemented 25 | 26 | - [x] `W`: [`./src/Alg/HDM/AlgW.hs`](./src/Alg/HDM/AlgW.hs) 27 | - *Robin Milner.* **A Theory of Type Polymorphism in Programming.** Journal of Computer and System Sciences, 1978. 28 | [[Paper](https://www.sciencedirect.com/science/article/pii/0022000078900144)] 29 | - [x] `DK`: [`./src/Alg/DK/DK.hs`](./src/Alg/DK/DK.hs) 30 | - *Jana Dunfield and Neelakantan R. Krishnaswami.* **Complete and Easy Bidirectional Typechecking for Higher-rank Polymorphism.** ICFP 2013. 31 | [[Paper](https://dl.acm.org/doi/10.1145/2500365.2500582)] 32 | - [x] `Worklist`: [`./src/Alg/DK/Worklist/DK.hs`](./src/Alg/DK/Worklist/DK.hs) 33 | - *Jinxu Zhao, Bruno C. d. S. Oliveira, and Tom Schrijvers.* **A Mechanical Formalization of Higher-Ranked Polymorphic Type Inference.** ICFP 2019. 34 | [[Paper](https://dl.acm.org/doi/10.1145/3341716)] 35 | - [x] `Elementary`: [`./src/Alg/DK/Worklist/Elementary.hs`](./src/Alg/DK/Worklist/Elementary.hs) 36 | - *Jinxu Zhao and Bruno C. d. S. Oliveira.* **Elementary Type Inference.** ECOOP 2022. 37 | [[Paper](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ECOOP.2022.2)] 38 | - [x] `R`: [`./src/Alg/HDM/AlgR.hs`](./src/Alg/HDM/AlgR.hs) 39 | - *Roger Bosman, Georgios Karachalias, Tom Schrijvers.* **No Unification Variable Left Behind: Fully Grounding Type Inference for the HDM System.** ITP 2023. 40 | [[Paper](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ITP.2023.8)] 41 | - [x] `Bounded`: [`./src/Alg/DK/Worklist/Bounded.hs`](./src/Alg/DK/Worklist/Bounded.hs) 42 | - *Chen Cui, Shengyi Jiang, and Bruno C. d. S. Oliveira.* **Greedy Implicit Bounded Quantification.** OOPSLA 2023. 43 | [[Paper](https://dl.acm.org/doi/10.1145/3622871)] 44 | - [x] `Contextual`: [`./src/Alg/Local/Contextual/Contextual.hs`](./src/Alg/Local/Contextual/Contextual.hs) 45 | - *Xu Xue and Bruno C. d. S. Oliveira.* **Contextual Typing.** ICFP 2024. 46 | [[Paper](https://dl.acm.org/doi/10.1145/3674655)] 47 | - [x] `IU`: [`./src/Alg/DK/Worklist/IU.hs`](./src/Alg/DK/Worklist/IU.hs) 48 | - *Shengyi Jiang, Chen Cui and Bruno C. d. S. Oliveira.* **Bidirectional Higher-Rank Polymorphism with Intersection and Union Types.** POPL 2025. 49 | [[Paper](https://i.cs.hku.hk/~bruno/papers/popl25_hrp.pdf)] 50 | 51 | ## Contribution 52 | 53 | Contributions are welcome! If you're interested in improving this project, please feel free to open an issue or submit a pull request. 54 | 55 | ## License 56 | 57 | This project is licensed under the MIT License. 58 | 59 | ## Disclaim 60 | 61 | This project is still in its early stages, and I am not an expert in either type inference or Haskell :) Please use it at your own risk (Some of the code was assisted by GitHub Copilot or ChatGPT). If you spot any issues or have suggestions, please open an issue to help improve the project. -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /app/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE LambdaCase #-} 2 | 3 | module Main (main) where 4 | 5 | import Alg 6 | import Data.Foldable (find) 7 | import Data.Tree.View (showTree) 8 | import Opt (Option (..), options) 9 | import Parser (parseTrm) 10 | import Print (showTreeHtml, toNodeInfoTree) 11 | import Syntax (Trm) 12 | import System.Console.GetOpt (ArgOrder (Permute), getOpt) 13 | import System.Environment (getArgs) 14 | 15 | runAlg :: Bool -> String -> Trm -> String 16 | runAlg html algName = case algName of 17 | "W" -> outTree runAlgW 18 | "DK" -> outTree runDK 19 | "Worklist" -> outStr runWorklist 20 | "Elementary" -> outStr runElementary 21 | "Bounded" -> outStr runBounded 22 | "IU" -> outStr runIU 23 | "Contextual" -> outTree runContextual 24 | "R" -> outTree runAlgR 25 | _ -> error $ "Invalid algorithm: " ++ algName 26 | where 27 | outStr alg tm = case alg tm of 28 | Left err -> unlines err 29 | Right msgs -> unlines msgs 30 | outTree alg tm = case alg tm of 31 | Left err -> err 32 | Right tree -> (if html then showTreeHtml . toNodeInfoTree else showTree) tree 33 | 34 | main :: IO () 35 | main = do 36 | args <- getArgs 37 | case getOpt Permute options args of 38 | (flags, [code], []) 39 | | Just (Alg algName) <- find (\case Alg _ -> True; _ -> False) flags -> do 40 | case parseTrm code of 41 | Left err -> putStrLn err 42 | Right tm -> putStrLn $ runAlg (Html `elem` flags) algName tm 43 | (_, _, errs) -> print errs 44 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "inputs": { 5 | "systems": "systems" 6 | }, 7 | "locked": { 8 | "lastModified": 1731533236, 9 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 10 | "owner": "numtide", 11 | "repo": "flake-utils", 12 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 13 | "type": "github" 14 | }, 15 | "original": { 16 | "owner": "numtide", 17 | "repo": "flake-utils", 18 | "type": "github" 19 | } 20 | }, 21 | "ghc-wasm-meta": { 22 | "inputs": { 23 | "flake-utils": "flake-utils", 24 | "nixpkgs": "nixpkgs" 25 | }, 26 | "locked": { 27 | "host": "gitlab.haskell.org", 28 | "lastModified": 1734354225, 29 | "narHash": "sha256-c7uY4XcZNO0krdOXtaoE/ZW7w38BjC3o9pQjrwfQrO8=", 30 | "owner": "ghc", 31 | "repo": "ghc-wasm-meta", 32 | "rev": "f0faac335c6f5e967d1bdbfca5768232483fd2a8", 33 | "type": "gitlab" 34 | }, 35 | "original": { 36 | "host": "gitlab.haskell.org", 37 | "owner": "ghc", 38 | "repo": "ghc-wasm-meta", 39 | "type": "gitlab" 40 | } 41 | }, 42 | "nixpkgs": { 43 | "locked": { 44 | "lastModified": 1734119587, 45 | "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", 46 | "owner": "NixOS", 47 | "repo": "nixpkgs", 48 | "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", 49 | "type": "github" 50 | }, 51 | "original": { 52 | "owner": "NixOS", 53 | "ref": "nixos-unstable", 54 | "repo": "nixpkgs", 55 | "type": "github" 56 | } 57 | }, 58 | "root": { 59 | "inputs": { 60 | "ghc-wasm-meta": "ghc-wasm-meta" 61 | } 62 | }, 63 | "systems": { 64 | "locked": { 65 | "lastModified": 1681028828, 66 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 67 | "owner": "nix-systems", 68 | "repo": "default", 69 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 70 | "type": "github" 71 | }, 72 | "original": { 73 | "owner": "nix-systems", 74 | "repo": "default", 75 | "type": "github" 76 | } 77 | } 78 | }, 79 | "root": "root", 80 | "version": 7 81 | } 82 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | ghc-wasm-meta.url = "gitlab:ghc/ghc-wasm-meta?host=gitlab.haskell.org"; 4 | }; 5 | outputs = inputs: inputs.ghc-wasm-meta.inputs.flake-utils.lib.eachDefaultSystem (system: 6 | let pkgs = inputs.ghc-wasm-meta.inputs.nixpkgs.legacyPackages.${system}; 7 | in 8 | { 9 | devShells.default = pkgs.mkShell { 10 | packages = [ 11 | inputs.ghc-wasm-meta.packages.${system}.all_9_6 12 | (pkgs.haskell-language-server.override { supportedGhcVersions = ["96"]; }) 13 | pkgs.haskell.compiler.ghc96 14 | ]; 15 | }; 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.tgz 3 | .DS_Store 4 | .idea 5 | .temp 6 | .vite_opt_cache 7 | .vscode 8 | dist 9 | cache 10 | temp 11 | examples-temp 12 | node_modules 13 | pnpm-global 14 | *.timestamp-*.mjs 15 | -------------------------------------------------------------------------------- /frontend/.vitepress/config.mts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitepress' 2 | 3 | // https://vitepress.dev/reference/site-config 4 | export default defineConfig({ 5 | title: "Type Inference Zoo", 6 | description: "Type Inference Algorithm Collections", 7 | themeConfig: { 8 | // https://vitepress.dev/reference/default-theme-config 9 | nav: [ 10 | { text: 'Home', link: '/' }, 11 | { text: 'Playground', link: '/playground' }, 12 | { text: 'Reference', link: '/quick-reference' }, 13 | { text: 'Research', link: '/research' }, 14 | ], 15 | 16 | sidebar: [], 17 | 18 | socialLinks: [ 19 | { icon: 'github', link: 'https://github.com/cu1ch3n/type-inference-zoo' } 20 | ], 21 | 22 | footer: { 23 | message: 'Released under the MIT License.', 24 | copyright: 'Copyright © 2025 Chen Cui' 25 | } 26 | }, 27 | cleanUrls: true 28 | }) 29 | -------------------------------------------------------------------------------- /frontend/.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | // https://vitepress.dev/guide/custom-theme 2 | import { h } from 'vue' 3 | import type { Theme } from 'vitepress' 4 | import DefaultTheme from 'vitepress/theme' 5 | import './style.css' 6 | import 'primeicons/primeicons.css'; 7 | import "@fontsource/iosevka"; 8 | import PrimeVue from 'primevue/config'; 9 | import Button from "primevue/button"; 10 | import AutoComplete from "primevue/autocomplete"; 11 | import SelectButton from 'primevue/selectbutton'; 12 | import Textarea from 'primevue/textarea'; 13 | import { definePreset } from '@primevue/themes'; 14 | import Aura from '@primevue/themes/aura'; 15 | 16 | const MyPreset = definePreset(Aura, { 17 | semantic: { 18 | primary: { 19 | 50: '{blue.50}', 20 | 100: '{blue.100}', 21 | 200: '{blue.200}', 22 | 300: '{blue.300}', 23 | 400: '{blue.400}', 24 | 500: '{blue.500}', 25 | 600: '{blue.600}', 26 | 700: '{blue.700}', 27 | 800: '{blue.800}', 28 | 900: '{blue.900}', 29 | 950: '{blue.950}' 30 | } 31 | } 32 | }); 33 | 34 | 35 | export default { 36 | extends: DefaultTheme, 37 | Layout: () => { 38 | return h(DefaultTheme.Layout, null, { 39 | // https://vitepress.dev/guide/extending-default-theme#layout-slots 40 | }) 41 | }, 42 | enhanceApp({ app, router, siteData }) { 43 | app.use(PrimeVue, { 44 | theme: { 45 | preset: MyPreset, 46 | options: { 47 | prefix: 'p', 48 | darkModeSelector: '.dark', 49 | cssLayer: false 50 | } 51 | } 52 | }); 53 | app.component('Button', Button); 54 | app.component('AutoComplete', AutoComplete); 55 | app.component('SelectButton', SelectButton); 56 | app.component('Textarea', Textarea); 57 | } 58 | } satisfies Theme 59 | -------------------------------------------------------------------------------- /frontend/.vitepress/theme/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Customize default theme styling by overriding CSS variables: 3 | * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css 4 | */ 5 | 6 | @tailwind base; 7 | @tailwind components; 8 | @tailwind utilities; 9 | 10 | /** 11 | * Colors 12 | * 13 | * Each colors have exact same color scale system with 3 levels of solid 14 | * colors with different brightness, and 1 soft color. 15 | * 16 | * - `XXX-1`: The most solid color used mainly for colored text. It must 17 | * satisfy the contrast ratio against when used on top of `XXX-soft`. 18 | * 19 | * - `XXX-2`: The color used mainly for hover state of the button. 20 | * 21 | * - `XXX-3`: The color for solid background, such as bg color of the button. 22 | * It must satisfy the contrast ratio with pure white (#ffffff) text on 23 | * top of it. 24 | * 25 | * - `XXX-soft`: The color used for subtle background such as custom container 26 | * or badges. It must satisfy the contrast ratio when putting `XXX-1` colors 27 | * on top of it. 28 | * 29 | * The soft color must be semi transparent alpha channel. This is crucial 30 | * because it allows adding multiple "soft" colors on top of each other 31 | * to create a accent, such as when having inline code block inside 32 | * custom containers. 33 | * 34 | * - `default`: The color used purely for subtle indication without any 35 | * special meanings attached to it such as bg color for menu hover state. 36 | * 37 | * - `brand`: Used for primary brand colors, such as link text, button with 38 | * brand theme, etc. 39 | * 40 | * - `tip`: Used to indicate useful information. The default theme uses the 41 | * brand color for this by default. 42 | * 43 | * - `warning`: Used to indicate warning to the users. Used in custom 44 | * container, badges, etc. 45 | * 46 | * - `danger`: Used to show error, or dangerous message to the users. Used 47 | * in custom container, badges, etc. 48 | * -------------------------------------------------------------------------- */ 49 | 50 | :root { 51 | --vp-c-default-1: var(--vp-c-gray-1); 52 | --vp-c-default-2: var(--vp-c-gray-2); 53 | --vp-c-default-3: var(--vp-c-gray-3); 54 | --vp-c-default-soft: var(--vp-c-gray-soft); 55 | 56 | --vp-c-brand-1: var(--vp-c-indigo-1); 57 | --vp-c-brand-2: var(--vp-c-indigo-2); 58 | --vp-c-brand-3: var(--vp-c-indigo-3); 59 | --vp-c-brand-soft: var(--vp-c-indigo-soft); 60 | 61 | --vp-c-tip-1: var(--vp-c-brand-1); 62 | --vp-c-tip-2: var(--vp-c-brand-2); 63 | --vp-c-tip-3: var(--vp-c-brand-3); 64 | --vp-c-tip-soft: var(--vp-c-brand-soft); 65 | 66 | --vp-c-warning-1: var(--vp-c-yellow-1); 67 | --vp-c-warning-2: var(--vp-c-yellow-2); 68 | --vp-c-warning-3: var(--vp-c-yellow-3); 69 | --vp-c-warning-soft: var(--vp-c-yellow-soft); 70 | 71 | --vp-c-danger-1: var(--vp-c-red-1); 72 | --vp-c-danger-2: var(--vp-c-red-2); 73 | --vp-c-danger-3: var(--vp-c-red-3); 74 | --vp-c-danger-soft: var(--vp-c-red-soft); 75 | } 76 | 77 | /** 78 | * Component: Button 79 | * -------------------------------------------------------------------------- */ 80 | 81 | :root { 82 | --vp-button-brand-border: transparent; 83 | --vp-button-brand-text: var(--vp-c-white); 84 | --vp-button-brand-bg: var(--vp-c-brand-3); 85 | --vp-button-brand-hover-border: transparent; 86 | --vp-button-brand-hover-text: var(--vp-c-white); 87 | --vp-button-brand-hover-bg: var(--vp-c-brand-2); 88 | --vp-button-brand-active-border: transparent; 89 | --vp-button-brand-active-text: var(--vp-c-white); 90 | --vp-button-brand-active-bg: var(--vp-c-brand-1); 91 | } 92 | 93 | /** 94 | * Component: Home 95 | * -------------------------------------------------------------------------- */ 96 | 97 | :root { 98 | --vp-home-hero-name-color: transparent; 99 | --vp-home-hero-name-background: -webkit-linear-gradient( 100 | 120deg, 101 | #bd34fe 30%, 102 | #41d1ff 103 | ); 104 | 105 | --vp-home-hero-image-background-image: linear-gradient( 106 | -45deg, 107 | #bd34fe 50%, 108 | #47caff 50% 109 | ); 110 | --vp-home-hero-image-filter: blur(44px); 111 | } 112 | 113 | @media (min-width: 640px) { 114 | :root { 115 | --vp-home-hero-image-filter: blur(56px); 116 | } 117 | } 118 | 119 | @media (min-width: 960px) { 120 | :root { 121 | --vp-home-hero-image-filter: blur(68px); 122 | } 123 | } 124 | 125 | /** 126 | * Component: Custom Block 127 | * -------------------------------------------------------------------------- */ 128 | 129 | :root { 130 | --vp-custom-block-tip-border: transparent; 131 | --vp-custom-block-tip-text: var(--vp-c-text-1); 132 | --vp-custom-block-tip-bg: var(--vp-c-brand-soft); 133 | --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft); 134 | } 135 | 136 | /** 137 | * Component: Algolia 138 | * -------------------------------------------------------------------------- */ 139 | 140 | .DocSearch { 141 | --docsearch-primary-color: var(--vp-c-brand-1) !important; 142 | } 143 | 144 | .cm-content, .cm-gutter { min-height: 100px !important; } 145 | .cm-gutters { margin: 1px; } 146 | .cm-scroller { overflow: auto; } 147 | .cm-wrap { border: 1px solid silver } 148 | 149 | .code { 150 | font-size: 1.5em !important; 151 | font-family: 'Iosevka', monospace !important; 152 | } 153 | 154 | .output { 155 | font-size: 0.9em !important; 156 | font-family: 'Iosevka', monospace !important; 157 | } 158 | -------------------------------------------------------------------------------- /frontend/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # https://vitepress.dev/reference/default-theme-home-page 3 | layout: home 4 | 5 | hero: 6 | name: "Type Inference Zoo" 7 | tagline: Explore with Type Inference Algorithms 8 | actions: 9 | - theme: brand 10 | text: Playground 11 | link: /playground 12 | - theme: alt 13 | text: Research 14 | link: /research 15 | - theme: alt 16 | text: Github 17 | link: https://github.com/cu1ch3n/type-inference-zoo 18 | 19 | features: 20 | - icon: 🕹️ 21 | title: Interactive Playground 22 | details: Try out type inference examples and explore various algorithms directly in the browser. Hands-on experience made simple. 23 | - icon: 🧩 24 | title: Unified Syntax and Implmentation 25 | details: A consistent syntax across multiple type inference algorithms—no need to waste time building new parsers or pretty printers. 26 | - icon: 👩‍💻 27 | title: Friendly to Language Implementers 28 | details: Code is probably less ambiguous than the notation used in the paper and more approachable. 29 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "autoprefixer": "^10.4.20", 4 | "postcss": "^8.4.49", 5 | "tailwindcss": "^3.4.17", 6 | "vitepress": "^1.5.0" 7 | }, 8 | "scripts": { 9 | "docs:dev": "vitepress dev", 10 | "docs:build": "vitepress build", 11 | "docs:preview": "vitepress preview" 12 | }, 13 | "dependencies": { 14 | "@bjorn3/browser_wasi_shim": "^0.3.0", 15 | "@fontsource/iosevka": "^5.1.0", 16 | "@primevue/themes": "^4.2.5", 17 | "primeicons": "^7.0.0", 18 | "primevue": "^4.2.5", 19 | "vue": "^3.5.13" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /frontend/playground.md: -------------------------------------------------------------------------------- 1 | 156 | 157 | 190 | 191 | 192 |
193 | 194 | 196 |
197 | 198 |
199 | 200 |
201 | 205 |
206 |
207 | 208 |
209 | 210 |