This gives a bit more helpful error message:
type Curve*[T] = object
cp: seq[T] or iterator: T
proc linear*[T](cp: seq[T] or iterator: T): auto =
result = Curve[T](cp: cp)
let vf = @[0,1,2,3,4,5,6,7,8,9]
var tlin = linear(vf)
Run
`/usercode/in.nim(8, 18) Error: expression 'linear(vf)' has no type (or is
ambiguous)`
It seems like it doesn't matter with which type you initialize `cp`, `Curve`
stays the same type. An easy but inelegant solution additionally to your own
solution:
type Curve*[T] = object
cp: T
proc linear*[T](cp: seq[T] or iterator: T): auto =
result = Curve[typeof cp](cp: cp)
let vf = @[0,1,2,3,4,5,6,7,8,9]
var tlin = linear(vf)
Run