-
Notifications
You must be signed in to change notification settings - Fork 69
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
topSort
doesn't know that the result of scc
has no cycles
#152
Comments
topoSort
doesn't know that the result of scc
has no cyclestopSort
doesn't know that the result of scc
has no cycles
This is indeed annoying, but I don't know how to nicely capture acyclicity in types. We could provide a separate function for Any ideas are welcome! |
All I can think of is adding a phantom type parameter to track acyclicity, but that seems very heavyweight for marginal benefit. |
Although heavyweight, phantom type parameters can bring other benefits too. We could use them for capturing all these graph variations in a uniform way:
So, in principle I'm ready to consider phantom types as a possible solution. |
Well, except presumably you want all combinations of those properties, so either you need type level sets or lots of parameters. |
It might be worth looking into linear types for this area. |
@subttle I'm not sure how linear types can help. Could you clarify? |
Hm, when I actually work through what I had in mind it seems wayy more hacky than I thought it would be so I will say never mind for now and post back here if I figure out a way to do it nicer :P |
Two approaches that come to mind are |
@chessai Thanks, indeed! Also, |
A mild annoyance. Often you want to topologically sort your SCCs after condensing them. Indeed, part of the point is to get rid of cycles so your topological sort is well-defined!
But sadly
topoSort
doesn't know that we now have an acyclic graph, so still tells us the result might beNothing
.The text was updated successfully, but these errors were encountered: