You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program claims that emit[<first-class function type>] is not allowed on the RHS of for, but I can't really tell why:
importstreamdefapplyAllAndSum(operations: List[(Int) =>Unit/ emit[Int] at {}], n: Int):Int/ {} = sum {
withvalop=for[(Int) =>Unit/ emit[Int] at {}] { operations.each }
// ^^^^^^^^^^^^^^^// Possible overload: stream::each of type [A](List[A]) => Unit / { emit[A] }// Effect emit[Int => Unit / { emit[Int] } at {}] is not allowed in this context.
(unbox op)(n)
}
Annotating the type of each as operations.each[(Int) => Unit / emit[Int] at {}] doesn't do anything...
For context, the intended application is something like:
I can't even write a "monomorphized" version of for:
defmyfor { stream: () =>Unit/ emit[(Int) =>Unit/ emit[Int] at {}] } { action: ((Int) =>Unit/ emit[Int] at {}) =>Unit }:Unit/ {} =try {
stream()
// ^// Effect emit[Int => Unit / { emit[Int] } at {}] is not allowed in this context.
} with emit[(Int) =>Unit/ emit[Int] at {}] { value =>
resume(action(value))
}
The following program claims that
emit[<first-class function type>]
is not allowed on the RHS offor
, but I can't really tell why:Annotating the type of
each
asoperations.each[(Int) => Unit / emit[Int] at {}]
doesn't do anything...For context, the intended application is something like:
The text was updated successfully, but these errors were encountered: