Feature Request: Better Type Inference
Gekctek opened this issue · comments
The following does not seem to work in Motoko without either declaring types in the method generics or on the function definition for Iter.map()
let arr : [Int] = [1, 2, 3];
let arr2 : [Int] = arr |> Iter.fromArray(_) |> Iter.map(_, func x = x + 1) |> Iter.toArray(_);
Can be frustrating having to put type definitions everywhere with method calls like this, even if it seems clear what the types would be, especially when the type names get very long or are complex tuples
You surely mean
let arr2 : [Int] = arr |> Iter.fromArray(_) |> Iter.map(_, func x = x + 1) |> Iter.toArray(_);
You surely mean
let arr2 : [Int] = arr |> Iter.fromArray(_) |> Iter.map(_, func x = x + 1) |> Iter.toArray(_);
Oops. Ya, was trying to code by hand without checking. Lesson learned lol
Edited original