bos/text — pull request #40 by ppetr (2013-02-20 07:38:05+00:00)
Title: Add left folds with early termination.

This generalization allows expressing left folds that don't need to process the entire sequence, such as various searching functions.

I'm working on some improvements to [listlike](http://hackage.haskell.org/package/ListLike) and this would be a handy common combinator.

A (somewhat artificial) example:

```haskell
import Data.Text

findNth :: (Char -> Bool) -> Int -> Text -> Maybe Char
findNth p = foldlE' (const Nothing) f
where
f i x | p x = if i == 0 then Left (Just x)
else Right (i - 1)
| otherwise = Right i
```