Open twhitehead opened 2 years ago
I don't have an inherent objection, but I'd be concerned about exposing partial versions of these functions. In particular, if we expose the fully generalized versions from Foldable
we will accidentally expose a partial function when applied to other data structures. I'm not sure what the best way forward is.
Just expose specialized versions would, if nothing else, be consistent with the scan*
exports. That is, currently we have
scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b
scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
so it would seem logical to do
foldl' :: Foldable f => (b -> a -> b) -> b -> f a -> b
foldl1' :: (a -> a -> a) -> NonEmpty a -> a
Sorry I missed the original description. Yes, that seems reasonable, PR welcome.
Would seem logical if
RIO.NonEmpty
included theNonEmpty
specializedfold*1
variants in addition toscan*1
.Don't know for sure, but I expect they weren't included due to the fact they normally come via
Data.Foldable
and notData.List.NonEmpty
.