module Chiasma.Lens.Where where

import Control.Lens (Over, taking)

where1 :: (Applicative f, Traversable t) => (a -> Bool) -> Over (->) f (t a) (t a) a a
where1 :: forall (f :: * -> *) (t :: * -> *) a.
(Applicative f, Traversable t) =>
(a -> Bool) -> Over (->) f (t a) (t a) a a
where1 a -> Bool
predicate = Int
-> ((a -> BazaarT (->) f a a a) -> t a -> BazaarT (->) f a a (t a))
-> (a -> f a)
-> t a
-> f (t a)
forall (p :: * -> * -> *) (f :: * -> *) s t a.
(Conjoined p, Applicative f) =>
Int -> Traversing p f s t a a -> Over p f s t a a
taking Int
1 (((a -> BazaarT (->) f a a a) -> t a -> BazaarT (->) f a a (t a))
 -> (a -> f a) -> t a -> f (t a))
-> ((a -> BazaarT (->) f a a a) -> t a -> BazaarT (->) f a a (t a))
-> (a -> f a)
-> t a
-> f (t a)
forall a b. (a -> b) -> a -> b
$ (a -> BazaarT (->) f a a a) -> t a -> BazaarT (->) f a a (t a)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b)
traverse ((a -> BazaarT (->) f a a a) -> t a -> BazaarT (->) f a a (t a))
-> ((a -> BazaarT (->) f a a a) -> a -> BazaarT (->) f a a a)
-> (a -> BazaarT (->) f a a a)
-> t a
-> BazaarT (->) f a a (t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Bool) -> Traversal' a a
forall a. (a -> Bool) -> Traversal' a a
filtered a -> Bool
predicate