Information of `T` and `V` already available from parent function so your 
iterator doesn't have to generic. Also, if a function cannot infer from 
argument, the workaround is that you have to be explicit.
    
    
    proc allExactCover*[T, V](constraints: Constraints[T, V]): iterator (): 
Solution[T] =
      var
        solution: Solution[T]
      
      iterator nilIterator: Solution[T] {.closure.} =
        yield @[]
      
      iterator solve: Solution[T] {.closure.} =
        var c = initHashSet[V]()
        yield solution
      
      try:
        return solve
      except KeyError:
        return nilIterator
    
    proc sdk: iterator (): Solution[Choice] =
      var constraints = initConstraints[Choice, Constraint]()
      
      return allExactCover[Choice, Constraint](constraints) # explicitly tell 
the type
    
    
    Run

Reply via email to