kongware / scriptum

Functional Programming Unorthodoxly Adjusted to Client-/Server-side Javascript
MIT License
383 stars 21 forks source link

Parsing nested higher-rank types leads to invalid scopes #349

Closed ivenmarquardt closed 3 years ago

ivenmarquardt commented 3 years ago

Coyoneda seems to be the litmus test of scriptum's type validator. It causes bugs throughout the evaluation process. The following type isn't parsed correctly:

const Coyoneda_ = type1("(^r. (^b. (b => a) => f<b> => r) => r) => Coyoneda<f, a>")
//                                                     ^     ^
//                                                  rank-2  rank-1

Here r is parsed as rank-1 and rank-2, although only rank-2 is right.

ivenmarquardt commented 3 years ago

Done.