{"id":13998218,"url":"https://github.com/hkust-taco/mlscript","last_synced_at":"2025-07-23T06:30:58.077Z","repository":{"id":37365353,"uuid":"395536587","full_name":"hkust-taco/mlscript","owner":"hkust-taco","description":"The MLscript programming language. Functional and object-oriented; structurally typed and sound; with powerful type inference. Soon to have full interop with TypeScript!","archived":false,"fork":false,"pushed_at":"2024-10-28T14:03:57.000Z","size":15162,"stargazers_count":170,"open_issues_count":30,"forks_count":25,"subscribers_count":6,"default_branch":"mlscript","last_synced_at":"2024-10-29T22:54:04.550Z","etag":null,"topics":["functional-programming","type-inference"],"latest_commit_sha":null,"homepage":"https://hkust-taco.github.io/mlscript","language":"Scala","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/hkust-taco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2021-08-13T05:58:09.000Z","updated_at":"2024-10-23T03:11:10.000Z","dependencies_parsed_at":"2024-01-15T14:08:39.670Z","dependency_job_id":"0ef52995-97ba-4480-ba7d-9a35382d8d2c","html_url":"https://github.com/hkust-taco/mlscript","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkust-taco%2Fmlscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkust-taco%2Fmlscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkust-taco%2Fmlscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkust-taco%2Fmlscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hkust-taco","download_url":"https://codeload.github.com/hkust-taco/mlscript/tar.gz/refs/heads/mlscript","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227227803,"owners_count":17751142,"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":["functional-programming","type-inference"],"created_at":"2024-08-09T19:01:29.140Z","updated_at":"2024-11-30T00:31:17.086Z","avatar_url":"https://github.com/hkust-taco.png","language":"Scala","funding_links":[],"categories":["Scala"],"sub_categories":[],"readme":"# MLscript\n\nWhat would TypeScript look like if it had been designed with type inference and soundness in mind?\n\nWe provide one possible answer in MLscript, an object-oriented and functional programming language with records, generic classes, mix-in traits, first-class unions and intersections, instance matching, and ML-style principal type inference.\nThese features can be used to implement expressive class hierarchies as well as extensible sums and products.\n\nMLscript supports union, intersection, and complement (or negation) connectives, making sure they form a Boolean algebra, and add enough structure to derive a sound and complete type inference algorithm.\n\n## Getting Started\n\n### Project Structure\n\n#### Sub-Projects\n\n- The ts2mls sub-project allows you to use TypeScript libraries in MLscript. It can generate libraries' declaration information in MLscript by parsing TypeScript AST, which can be used in MLscript type checking.\n\n#### Directories\n\n- The `shared/src/main/scala/mlscript` directory contains the sources of the MLscript compiler.\n\n- The `shared/src/test/scala/mlscript` directory contains the sources of the testing infrastructure.\n\n- The `shared/src/test/diff` directory contains the actual tests.\n\n- The `ts2mls/js/src/main/scala/ts2mls` directory contains the sources of the ts2mls module.\n\n- The `ts2mls/js/src/test/scala/ts2mls` directory contains the sources of the ts2mls declaration generation test code.\n\n- The `ts2mls/jvm/src/test/scala/ts2mls` directory contains the sources of the ts2mls diff test code.\n\n- The `ts2mls/js/src/test/typescript` directory contains the TypeScript test code.\n\n- The `ts2mls/js/src/test/diff` directory contains the declarations generated by ts2mls.\n\n### Prerequisites\n\nYou need [JDK supported by Scala][supported-jdk-versions], [sbt][sbt], [Node.js][node.js], and TypeScript to compile the project and run the tests.\n\nWe recommend you to install JDK and sbt via [coursier][coursier]. The versions of Node.js that passed our tests are from v16.14 to v16.17, v17 and v18. Run `npm install` to install TypeScript. **Note that ScalaJS cannot find the global installed TypeScript.** We explicitly support TypeScript v4.7.4.\n\n[supported-jdk-versions]: https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html\n[sbt]: https://www.scala-sbt.org/\n[node.js]: https://nodejs.org/\n[coursier]: https://get-coursier.io/\n\n### Running the tests\n\nRunning the main MLscript tests only requires the Scala Build Tool installed.\nIn the terminal, run `sbt mlscriptJVM/test`.\n\nRunning the ts2mls MLscript tests requires NodeJS, and TypeScript in addition.\nIn the terminal, run `sbt ts2mlsTest/test`.\n\nYou can also run all tests simultaneously.\nIn the terminal, run `sbt test`.\n\n### Running tests individually\n\nIndividual tests can be run with `-z`.\nFor example, `~mlscriptJVM/testOnly mlscript.DiffTests -- -z parser` will watch for file changes and continuously run all parser tests (those that have \"parser\" in their name).\n\nYou can also indicate the test you want in `shared/src/test/scala/mlscript/DiffTests.scala`:\n\n```scala\n  // Allow overriding which specific tests to run, sometimes easier for development:\n  private val focused = Set[Str](\n    // Add the test file path here like this:\n    \"shared/src/test/diff/mlscript/Methods.mls\"\n  ).map(os.RelPath(_))\n```\n\nTo run the tests in ts2mls sub-project individually,\nyou can indicate the test you want in `ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala`:\n\n```scala\nprivate val testsData = List(\n    // Put all input files in the `Seq`\n    // Then indicate the output file's name\n    (Seq(\"Array.ts\"), \"Array.d.mls\")\n  )\n```\n\n### Running the web demo locally\n\nTo run the demo on your computer, compile the project with `sbt fastOptJS`, then open the `local_testing.html` file in your browser.\n\nYou can make changes to the type inference code\nin `shared/src/main/scala/mlscript`,\nhave it compile to JavaScript on file change with command\n`sbt ~fastOptJS`,\nand immediately see the results in your browser by refreshing the page with `F5`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkust-taco%2Fmlscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhkust-taco%2Fmlscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkust-taco%2Fmlscript/lists"}