ld) selected elements of a 'Control.Lens.Traversal.Traversal' (or 'Control.Lens.Fold.Fold') where their ordinal positions match a predicate.
--
-- @
-- 'elementsOf' :: 'Control.Lens.Traversal.Traversal'' s a -> ('Int' -> 'Bool') -> 'IndexedTraversal'' 'Int' s a
-- 'elementsOf' :: 'Control.Lens.Fold.Fold' s a            -> ('Int' -> 'Bool') -> 'Control.Lens.IndexedFold.IndexedFold' 'Int' s a
-- @
elementsOf :: (Applicative f, Indexable Int p)
           => LensLike (Indexing f) s t a a
           -> (Int -> Bool)
           -> IndexedLensLike p f s t a a
elementsOf l p iafb s =
  case runIndexing (l (\a -> Indexing (\i -> i `seq` (if p i then indexed iafb i a else pure a, i + 1))) s) 0 of
    (r, _) -> r
{-# INLINE elementsO
elementsOf :: (Applicative f, Indexable Int p)
           => LensLike (Indexing f) s t a a
           -> (Int -> Bool)
           -> IndexedLensLike p f s t a a
elementsOf l p iafb s =
  case runIndexing (l (\a -> Indexing (\i -> i `seq` (if p i then indexed iafb i a else pure a, i + 1))) s) 0 of
    (r, _) -> r

elementsOf l p iafb s =
  case runIndexing (l (\a -> Indexing (\i -> i `seq` (if p i then indexed iafb i a else pure a, i + 1))) s) 0 of
    (r, _) -> r
