foundation icon indicating copy to clipboard operation
foundation copied to clipboard

add `foldl1` in foundation's Collection.Collection.Foldable.

Open NicolasDP opened this issue 7 years ago • 2 comments

It would look like the following:

foldl1' :: Foldable col => (Element col -> Element col -> Element col)
                        -> NonEmpty col
                        -> Element col

Edit: don't implement a the lazy version of this function.

NicolasDP avatar Jun 10 '17 12:06 NicolasDP

foldl1' is probably a better idea.

ndmitchell avatar Jun 10 '17 13:06 ndmitchell

Is it wise to force any Foldable to also provide fold1? I am worried that this might prevent some types from having a Foldable instance.

ThreeFx avatar Jun 11 '17 09:06 ThreeFx