Git Product home page Git Product logo

mt's Issues

Bug in clause unification!

Clause unification uses "pairwiseChunk" - this is ridiculous - and leads to an error. for example this will pass the type checker:

foo() -> 1.0;
foo() -> 1.0;
foo() -> true;
foo() -> false.

Instead, it should make a "chain" of unification constraints..

Bring variable into scope if bound on all branches

Currently, this program is rejected although it is semantically valid:

x() -> 
    if
      true -> X = 1;
      false -> X = 3
    end,
    X.    %%line 24

with error:

test.erl: error in parse transform 'etc': {"Type Error: 'X' not bound on line 24

Pretty printing function types

Currently function types look like Haskell types, they need to look like "Erlang types"! That is: (a,b) -> a instead of a -> (b -> c)

Support numeric types

Requires implementation of (basic) type classes. Being able to type expressions like int + float depends on this.

Support single recursion

Do a pre-pass and assign a fresh type to each function in the environment before attempting to infer the types of each function

Incorrect type is inferred if the type of let binding is a type variable

Inferred type of lets(x,app(idterm(y),int(5)),X) is A !!

Trace:

Type of y = {tvar,#Ref<0.1275695646.2152202243.105277>}
Fresh Type of y = {tvar,#Ref<0.1275695646.2152202243.105277>}
App Type1 = {funt,[{tvar,#Ref<0.1275695646.2152202243.105277>}],
                  {tvar,#Ref<0.1275695646.2152202243.105277>}}
 Constraints1 = []
App Type2 = {bt,int}
 Constraints2 = []
LETX Type1 = {tvar,#Ref<0.1275695646.2152202243.105280>}
 Constraints1 = [{{funt,[{tvar,#Ref<0.1275695646.2152202243.105277>}],
                        {tvar,#Ref<0.1275695646.2152202243.105277>}},
                  {funt,[{bt,int}],
                        {tvar,#Ref<0.1275695646.2152202243.105280>}}}]
----------Env = []
Type of x = {forall,{tvar,#Ref<0.1275695646.2152202243.105280>},
                    {tvar,#Ref<0.1275695646.2152202243.105280>}}
Fresh Type of x = {tvar,#Ref<0.1275695646.2152202243.105286>}
LETX Type2 = {tvar,#Ref<0.1275695646.2152202243.105286>}
 Constraints2= []
A
Generated constraints are:
(B)->B :==: (int)->C
Inferred type: A

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.