-
Notifications
You must be signed in to change notification settings - Fork 177
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
NonEmpty for CyclicSCC #952
Comments
Or even go for data SCC vertex = SCC vertex [vertex] and |
Yes, let's do something of this sort. Your second representation doesn't seem to distinguish properly between vertices with no edges and ones with a single edge to themselves. import Data.Graph
main :: IO ()
main = do
print $ stronglyConnComp [((), (), [()])]
print $ stronglyConnComp [((), (), [])] This gives
As I understand it, your |
Ah, excellent point. How about this? Any better naming than data SCC vertex = AcyclicSCC vertex
| CyclicSCC' (NonEmpty vertex)
pattern CyclicSCC :: [vertex] -> SCC vertex
pattern CyclicSCC xs <- CyclicSCC' (NE.toList -> xs) where
CyclicSCC xs = CyclicSCC' (NE.fromList xs)
{-# COMPLETE AcyclicSCC, CyclicSCC #-} |
I must admit to some trepidation about committing to |
Do you mean |
I meant if you want |
|
I'd like to see how this affects the code, yeah. |
Can we maybe skip introducing the partial |
@meooow25 , we can just make it unidirectional, right? |
Yes, that's what I meant, should have stated explicitly. |
containers/containers/src/Data/Graph.hs
Lines 146 to 149 in 48196fb
How about changing this to
CyclicSCC (NonEmpty vertex)
? This could shave a number of unsafeData.List.head
in GHC and other compilers.Not sure about backward compatibility / migration schedule, probably a pattern synonym can help to ease the breakage.
The text was updated successfully, but these errors were encountered: