Closed
Description
There seems to be an issue with future's =>
and generics:
import sequtils, future
proc f*[T](x: T) =
let other = @[1, 2, 3]
var mapped = toSeq(0 ..< other.len).map(i => (other[i], i))
f(1)
Produces: lib/system.nim(3549, 14) Error: cannot instantiate: 'T'
The issue disappears:
- when
f
is not generic - when using other expressions like
i => (i, i)
- when writing the expression verbosely
toSeq(0 ..< other.len).map(proc(i: int): (int, int) = (other[i], i))