-
Notifications
You must be signed in to change notification settings - Fork 86
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
Support zeroOrMore for Rule2+ #122
Comments
Currently the typing is like this (one of the three possible cases): zeroOrMore(RuleN[A :: HNil]): RuleN[Seq[A] :: HNil] or shorter zeroOrMore(Rule1[A]): Rule1[Seq[A]] What would you like the type of zeroOrMore(RuleN[A :: B :: C :: HNil]) to be? |
Looking in more detail to the types, I can see why it does not work but it is still a very weird limitation and one that makes handling rules that produce multiple values a lot harder. |
What you want is this:
which I think is actually a reasonable request. |
Actually, what I want is zeroOrMore(RuleN[A :: B :: C :: ... :: HNil]): RuleN[Seq[A :: B :: C :: ... :: HNil] :: HNil] i.e. return multiple values (of different type) every time the rule is called. |
If that's what you want you can simply group your values into a tuple, no? |
Yes indeed I can do that. Another thing I overlooked. |
The following code
results in the following error:
This restriction is tedious, why does it exist? I worked around the problem by nesting the return value:
But this requires further overhead by constructing the return value and by destructing it afterwards. Are there other workarounds?
The text was updated successfully, but these errors were encountered: