Ejercicio sobre Lambdas

 import java.util.ArrayList;     import java.util.Collections;     import java.util.Comparator;     import java.util.List;       public class Arreglo {          public void ordenar(){             List<String> lista = new ArrayList<>();             lista.add("Mitocode");             lista.add("Code");             lista.add("Mito");              Collections.sort(lista, new Comparator<String>(){                  @Override                 public int compare(String o1, String o2) {                     return o1.compareTo(02);                 }             });              for (String elemento : lista){                 System.out.println(elemento);             }         }          public static void main(String[] args){             Arreglo app = new Arreglo();             app.ordenar();         }      } 

Me salen los siguientes errores: * import java.util.Comparator; (fila 3) * new ArrayList<>() (fila 10) * Comparator (fila 15) Si me pueden ayudar por favor compaƱers no tengo idea del por que de estos errores

Can we statically assign types to polymorphic lambdas using hindley milner style type inference

I am playing with a simple implicitly typed functional language and have implemented type checking using a Hindley Milner style system. In order to guide code generation, I want to tag each term with its type during type inference.

Of course my language uses lambda expressions and the implicit typing should enable nice polymorphic use of those lambdas. Unfortunately, this goal clashes with the static type tagging as each lambda can be tagged only once which specializes it for a particular set of argument and closure types. It is also not possible to statically copy lambdas on each use, as this requires dynamic knowledge.

I thought about dynamically copying and tagging lambdas at runtime but this would involve quite some work and possibly overhead. Is there a standard solution for this kind of problem?