{"id":22696147,"url":"https://github.com/zdimension/hm-infer-cs","last_synced_at":"2025-03-29T18:11:32.574Z","repository":{"id":97140612,"uuid":"471435340","full_name":"zdimension/hm-infer-cs","owner":"zdimension","description":"Hindley-Milner type inference for Scheme, in C#","archived":false,"fork":false,"pushed_at":"2022-03-22T12:21:32.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T18:52:12.945Z","etag":null,"topics":["csharp","hindley-milner","scheme","type-inference"],"latest_commit_sha":null,"homepage":"","language":"C#","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/zdimension.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-18T16:12:51.000Z","updated_at":"2022-03-18T16:13:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"8956553a-cd95-406f-883e-dea04f7d0e7d","html_url":"https://github.com/zdimension/hm-infer-cs","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/zdimension%2Fhm-infer-cs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fhm-infer-cs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fhm-infer-cs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fhm-infer-cs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zdimension","download_url":"https://codeload.github.com/zdimension/hm-infer-cs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223331,"owners_count":20743167,"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":["csharp","hindley-milner","scheme","type-inference"],"created_at":"2024-12-10T04:14:27.696Z","updated_at":"2025-03-29T18:11:32.569Z","avatar_url":"https://github.com/zdimension.png","language":"C#","readme":"# Hindley-Milner type inference for Scheme, in C#\n\nPort of [hm-infer-scheme](https://github.com/zdimension/hm-infer-scheme).\n\nThis is a type inference engine built on the Hindley-Milner algorithm, that analyzes, type-checks and computes the type of expressions written in an extended subset of Scheme.\n\n## Supported Scheme constructs\n\n- `(let ([name val] ...) body)`: basic `let`\n- `(let* ([name val] ...) body)`: ordered `let` (each symbol can access the symbols defined before it)\n- `(letrec ([name val] ...) body)`: `let` with recursion support (symbols can access themselves inside a lambda definition)\n- `(lambda (a b ...) body)`: lambda definition\n- `(head a b ...)`: procedure application (**difference from Scheme**: implicit partial application; such that `(pair a b)` is strictly equivalent to `((pair a) b)`)\n\n## Built-ins\n\nTypes:\n- `int` (Scheme `number?`)\n- `bool` (Scheme `boolean?`)\n- `str` (Scheme `string?`)\n- `unit` (void/unit type)\n- `bottom` (Haskell `forall a. a`, Rust `!`)\n\nSymbols:\n\u003ctable\u003e\n\u003cthead\u003e\n  \u003ctr\u003e\u003cth\u003e\u003c/th\u003e\u003cth\u003eName\u003c/th\u003e\u003cth\u003eSignature (n-ary syntax)\u003c/th\u003e\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n  \u003ctr\u003e\u003ctd rowspan=\"3\"\u003eNumbers\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e+\u003c/code\u003e, \u003ccode\u003e-\u003c/code\u003e, \u003ccode\u003e*\u003c/code\u003e, \u003ccode\u003e/\u003c/code\u003e, \u003ccode\u003emodulo\u003c/code\u003e, \u003ccode\u003esucc\u003c/code\u003e, \u003ccode\u003epred\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[int int] -\u0026gt; int\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e=\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[int int] -\u0026gt; bool\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ezero\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003eint -\u0026gt; bool\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n  \u003ctr\u003e\u003ctd\u003eBooleans\u003c/td\u003e\u003ctd\u003e\u003ccode\u003eand\u003c/code\u003e, \u003ccode\u003eor\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[bool bool] -\u0026gt; bool\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n  \u003ctr\u003e\u003ctd rowspan=\"2\"\u003eUtilities\u003c/td\u003e\u003ctd\u003e\u003ccode\u003eerror\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003estr -\u0026gt; never\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eif\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[bool a a] -\u0026gt; a\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n  \u003ctr\u003e\u003ctd rowspan=\"3\"\u003ePairs\u003c/td\u003e\u003ctd\u003e\u003ccode\u003epair\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[a b] -\u0026gt; (a * b)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ecar\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(a * b) -\u0026gt; a\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ecdr\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(a * b) -\u0026gt; b\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd rowspan=\"5\"\u003eLists\u003c/td\u003e\u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(list a)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003econs\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[a (list a)] -\u0026gt; (list a)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ehd\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(list a) -\u0026gt; a\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003etl\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(list a) -\u0026gt; (list a)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003enull?\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(list a) -\u0026gt; bool\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd rowspan=\"3\"\u003eEither\u003c/td\u003e\u003ctd\u003e\u003ccode\u003eleft\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003ea -\u0026gt; (either a b)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eright\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003eb -\u0026gt; (either a b)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eeither\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[(either a b) (a -\u0026gt; x) (b -\u0026gt; y)] -\u0026gt; (either x y)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd rowspan=\"3\"\u003eMaybe\u003c/td\u003e\u003ctd\u003e\u003ccode\u003ejust\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003ea -\u0026gt; (option a)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003enothing\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e(option a)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003emaybe\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e[(option a) (a -\u0026gt; x)] -\u0026gt; (option x)\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n## Internals \n\nAll functions are internally curried, as in Haskell, e.g. the type of `pair` is `(a -\u003e (b -\u003e (a * b)))`. \nThis allows for built-in support for partial application (cf. above) in the HM framework, while still allowing to define n-ary functions.\n\nIn effect, `(lambda (a b) body)` is syntactic sugar for `(lambda (a) (lambda (b) body))`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzdimension%2Fhm-infer-cs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzdimension%2Fhm-infer-cs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzdimension%2Fhm-infer-cs/lists"}