-
Notifications
You must be signed in to change notification settings - Fork 8
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
Dealing with extra parameters in recursive sumtypes #30
Comments
One solution would be to have the macro find all instances of the same sum type within the scope, and add additional parameters to them. So, for example, @sum_type LinkedList{T} begin
BranchNode(val::T, child::LinkedList{T})
EndNode(val::T)
end would have the referenced type expanded to BranchNode(val::T, child::LinkedList{T,8,1,UInt8}) |
Ah good point, I didn't think of that. Hmm, I'll need to think about the best way to approach this, it's actually a little tricky. |
Anything I can help with on this? |
Hey @MilesCranmer I don't think so. I've made a big overhaul going back to unions, but being smarter about some thing while handling them in #49, so there won't be any extra type parameters after that merges. |
Nice!! |
Hey @MasonProtter, really nice package.
Is there a way I can make a recursive SumType which uses the correct parametrized field type?
For example, say I want to make a linked list, with a separate type for the end of the list:
However, this
LinkedList
type referenced inBranchNode
is actually generic and will incur type inference issues, as the sum type is parametrized:Is there a way I can get this same parametrization within the
@sum_type
macro, so that I may use it to build recursive SumTypes?Cheers,
Miles
The text was updated successfully, but these errors were encountered: