module Precursor.Control.Applicative
(
Applicative
, pure
, (<*>)
, (*>)
, (<*)
, Const(..)
, WrappedArrow(..)
, ZipList(..)
, liftA2
, (<**>)
, forever
, when
, unless
, replicateA
, replicateA_
, filterA
) where
import Control.Applicative
import Control.Monad
import Precursor.Data.Bool
import Precursor.Numeric.Num
import qualified Prelude
replicateA :: (Applicative f) => Prelude.Int -> f a -> f [a]
replicateA cnt0 f =
loop cnt0
where
loop cnt
| cnt Prelude.<= 0 = pure []
| otherwise = liftA2 (:) f (loop (cnt Prelude.- 1))
replicateA_ :: (Applicative f) => Prelude.Int -> f a -> f ()
replicateA_ cnt0 f =
loop cnt0
where
loop cnt
| cnt Prelude.<= 0 = pure ()
| otherwise = f *> loop (cnt Prelude.- 1)
filterA :: Applicative f => (a -> f Bool) -> [a] -> f [a]
filterA = filterM