hkuplg / fcore

Research middleware compiler from System F-based languages to Java with the Imperative Functional Object encoding
http://hkuplg.github.io/fcore
BSD 2-Clause "Simplified" License
44 stars 12 forks source link

Better support of type inference #87

Open zonyitoo opened 9 years ago

zonyitoo commented 9 years ago

It would be much more convenient if we don't need to write type annotations...

data PolyList [A] = Nil
                  | Cons A (PolyList[A]);

let rec map [A, B] (f : A -> B) (l : PolyList[A]) : PolyList[B] =
    case l of
        Nil             ->      Nil
     |  Cons x xs       ->      Cons (f x) (map f xs);

map (\x -> x + 1) (Cons 1 Nil)

which means that I don't need to tell compiler explicitly.

zonyitoo commented 9 years ago

split from #84

brunocdsoliveira commented 9 years ago

Definitely a desirable feature, but unlikely to be supported any time soon ...

zonyitoo commented 9 years ago

@brunocdsoliveira I have discussed with @zhiyuanshi about this. It is a little bit complicated to support type inference in F2J...