Polymorphic types in jsligo and reasonligo

Merged Pierre-Emmanuel Wulfman requested to merge generics_in_jsligo_and_reasonligo into dev


closes #1385 (closed)

Here put what you want to share with ligo developpers. It'll not be part of the changelog.

As discussed before, we change the polymorphic types representation by removing _a and have a more proper notation.

##For Reasonligo, I extended the ReasonML notation :

let myIdentity = (type a, arg : a) : a => arg;

for multiple types:

let myIdentity = (type (a,b), (arg,toto) : a * b) : b * a => (toto,arg);

I am not sure how to add it in type annotation.

##For JSLigo, I implemented only the TS type annotation :

let myIdentity: <Input>(arg: Input) => Input = arg => arg;

Feel free to extend with new notations later.

Side effect

  • The concept of "generalizable variable" disappeared.
  • Polymorphism is now represented with a Big Lambda in the ASTs

Changelog details:

Here put what you want to share with ligo users through changelog.

Replace polymorphism syntax to have explicit polymorphic type "declaration"

Edited by Didier Plaindoux