Use `foldMap1'` in `O.N.Protocol.Handshake.Version.foldMapVersions`
samcowger opened this issue · comments
At the moment, foldMapVersions
is rendered like so:
foldMapVersions
is precisely foldMap1
, and could be more efficiently rendered as foldMap1'
. These functions are included in Foldable1
, a class introduced in base-4.18
, so once ouroboros-network-frameworks
is migrated to GHC 9.6, we should leverage one of them (probably foldMap1'
) in this definition. (The current definition's inefficiency comes from converting to a list and using a lazy left fold., foldl1
.)