Giter Site home page Giter Site logo

hkust-taco / mlstruct Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 2.0 5.52 MB

Codebase for the paper "MLstruct: Principal Type Inference in a Boolean Algebra of Structural Types"

Home Page: https://hkust-taco.github.io/mlstruct

License: MIT License

Scala 97.59% CSS 0.50% HTML 1.87% TypeScript 0.03%
functional-programming type-inference

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

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

Stargazers

Tate Burns avatar Aleksandr avatar Oliver Berg avatar breandan avatar Wenhao Tang avatar Masanori Ogino avatar Erich Ocean avatar Winnie Quinn avatar  avatar Laurent Moussault avatar  avatar Turo Lamminen avatar lyj avatar Michael Neumann avatar Tom Brunoli avatar Michał Łępicki avatar Victor Borja avatar Radek Szymczyszyn avatar Baldvin Dagur Rúnarsson avatar WJH avatar sudotty avatar Ilmari Vacklin avatar  avatar

Watchers

 avatar lyj 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.