Add `flattenSCC1 : SCC vertex -> Data.List.NonEmpty.NonEmpty vertex`
andreasabel opened this issue · comments
The flattenSCC
function throws away the knowledge that a SCC is a non-empty list of vertices:
containers/containers/src/Data/Graph.hs
Lines 248 to 251 in a4e8d16
In course of the new x-partial
warning of GHC 9.8, this is a bit inconvenient, since GHC will now cry about head . flattenSCC
and similar.
The more correct type of flattenSCC
is SCC vertex -> Data.List.NonEmpty.NonEmpty vertex
, but in order not to break everyone's code I suggest to add a new function flattenSCC1
instead.
Should this maybe have gone into containers-0.7
?
@andreasabel one workaround is to use Data.Foldable1.toNonEmpty
, there is an instance.
I don't have a strong opinion either way. I'd lean toward adding the function because it seems a bit odd to give the less informative version its own name but not the more informative one.