Open andreasabel opened 5 months ago
@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.
The
flattenSCC
function throws away the knowledge that a SCC is a non-empty list of vertices: https://github.com/haskell/containers/blob/a4e8d167c0c0f0001e48f499d33735a61c68d9d4/containers/src/Data/Graph.hs#L248-L251In course of the new
x-partial
warning of GHC 9.8, this is a bit inconvenient, since GHC will now cry abouthead . flattenSCC
and similar.The more correct type of
flattenSCC
isSCC vertex -> Data.List.NonEmpty.NonEmpty vertex
, but in order not to break everyone's code I suggest to add a new functionflattenSCC1
instead.Should this maybe have gone into
containers-0.7
?