-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hitting apply limit when using functor application #504
Comments
Yes, this is a known limitation. The syntax you're using is provided by It seems that all your elements have the same type – scala> List("1".successNel[String], ...).sequenceU
res0: scalaz.Validation[scalaz.NonEmptyList[String],List[String]] = Success(List(1, 2, ...)) However, if your actual code requires the elements to be of different type, you can use shapeless-contrib: sequence(
"1".successNel[String] ::
"2".successNel[String] ::
... ::
HNil
).map { case x :: y :: ... :: HNil =>
f(x, y, ...)
} This exactly mimics the previous Does either solution work for you? |
The example I used just demonstrated the problem, the real code has many different types that are wrapped in Validation The second solution looks like it can work fine, as long as I get a nel of failures. I am wondering, if the issue with ApplicativeBuilder should be better solved by making it a macro (if it goes down to boilerplate), since that way you can just specify the max arity without being limited by a hard coded limit? |
Yes.
There is no actual need for macros here, since |
Im attempting to use the code you mentioned above, however it seems that the statement function doesn't exist in the shapeless-contrib package that you linked me to |
Actually nvm, it seems to be in SNAPSHOT-2.0 which is no longer in maven repos |
It's not "no longer" in Maven repositories; you can fetch it from the |
We have pieces of code where we are hitting the hardcoded limit for functor application
As a simple test case, the following piece of Scala code fails
where as this works fine
Is there any work around for this hard limit, or plans to address this limitation (it seems to be the similar issue that scala has with things like tuples and whatnot)?
The text was updated successfully, but these errors were encountered: