foldl1 f = foldl1 f . toList
>>> foldl1 (+) [1..4] 10
>>> foldl1 (+) [] *** Exception: Prelude.foldl1: empty list
>>> foldl1 (+) Nothing *** Exception: foldl1: empty structure
>>> foldl1 (-) [1..4] -8
>>> foldl1 (&&) [True, False, True, True] False
>>> foldl1 (||) [False, False, True, True] True
>>> foldl1 (+) [1..] * Hangs forever *
>>> foldl1 (+) [1..4] 10 >>> foldl1 (+) [] *** Exception: Prelude.foldl1: empty list >>> foldl1 (-) [1..4] -8 >>> foldl1 (&&) [True, False, True, True] False >>> foldl1 (||) [False, False, True, True] True >>> foldl1 (+) [1..] * Hangs forever *
>>> bifoldl1 (+) (5, 7) 12
>>> bifoldl1 (+) (Right 7) 7
>>> bifoldl1 (+) (Left 5) 5
> bifoldl1 (+) (BiList [1, 2] [3, 4]) 10 -- ((1 + 2) + 3) + 4
>>> bifoldl1 (+) (BiList [1, 2] []) 3On empty structures, this function throws an exception:
>>> bifoldl1 (+) (BiList [] []) *** Exception: bifoldl1: empty structure ...