kongware / ftor

ftor enables ML-like type-directed, functional programming with Javascript including reasonable debugging.
MIT License
44 stars 1 forks source link

Bug in unification process of homogeneous arrays #20

Closed ivenmarquardt closed 6 years ago

ivenmarquardt commented 6 years ago

The following program should type check:

const f = Fun("(f :: (a -> b) -> a -> b)", f => x => f(x));
const g = Fun("(g :: (a -> a) -> a -> a)", f => x => f(x));
const xs = Arr([f, g]); // type error

Uncaught ExtendedTypeError: Arr expects homogeneous Array

[(f :: (a -> b) -> a -> b), (g :: (a -> a) -> a -> a)]

2 elements of different type received

    at _throw (http://localhost/repos/ftor/src/ftor.js:3993:9)
    at Module.Arr (http://localhost/repos/ftor/src/ftor.js:3268:29)
    at http://localhost/test.js:1164:16
ivenmarquardt commented 6 years ago

This bug applies to all ftor specific types except typed functions and ADTs:

ivenmarquardt commented 6 years ago

Done.