Code Monkey home page Code Monkey logo

mlstruct's Introduction

This repository contains an implementation of MLstruct, the Boolean-algebraic core of MLscript. It is relatively faithful to the OOPSLA 2022 paper MLstruct: Principal Type Inference in a Boolean Algebra of Structural Types. To obtain MLstruct, we started from the full MLscript language prototype and removed most of the extra features/bells and whistles, and made some extra simplifications.

MLstruct

What would TypeScript look like if it had been designed with type inference and soundness in mind?

We 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. These features can be used to implement a form of extensible variants that is as powerful as but also more flexible than unification-based approaches using row variables.

MLstruct supports union, intersection, and complement (or negation) connectives. We make sure they form a Boolean algebra and add enough structure to derive a sound and complete type inference algorithm. For more details, please see the paper mentioned above.

Commands Summary

Running the tests

Running the tests only requires the Scala Build Tool and NodeJS installed. In the terminal, run sbt mlscriptJVM/test.

To run the regression tests continuously as you develop, launch the SBT shell first with sbt and then type ~mlscriptJVM/testOnly mlscript.DiffTests.

Running the web demo locally

To run the web demo on your computer, compile the project with sbt fastOptJS, then open the local_testing.html file in your browser.

You can make changes to the type inference code in shared/src/main/scala/mlscript, have it compile to JavaScript on file change with command sbt ~fastOptJS, and immediately see the results in your browser by refreshing the page with F5.

mlstruct's People

Contributors

andongfan avatar chengluyu avatar elrouille avatar fo5for avatar lptk avatar mahzoun99 avatar meowcolm024 avatar twitu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

andongfan fo5for

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.