module ZkFold.Base.Data.Utils where

import           Control.Applicative (Applicative)
import           Data.Traversable    (Traversable (..))
import           Data.Zip            (Zip (..))
import           Prelude             (($))

zipWithM :: (Traversable f, Zip f, Applicative m) => (a -> b -> m c) -> f a -> f b -> m (f c)
zipWithM :: forall (f :: Type -> Type) (m :: Type -> Type) a b c.
(Traversable f, Zip f, Applicative m) =>
(a -> b -> m c) -> f a -> f b -> m (f c)
zipWithM a -> b -> m c
f f a
a f b
b = f (m c) -> m (f c)
forall (t :: Type -> Type) (f :: Type -> Type) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
forall (f :: Type -> Type) a. Applicative f => f (f a) -> f (f a)
sequenceA (f (m c) -> m (f c)) -> f (m c) -> m (f c)
forall a b. (a -> b) -> a -> b
$ (a -> b -> m c) -> f a -> f b -> f (m c)
forall a b c. (a -> b -> c) -> f a -> f b -> f c
forall (f :: Type -> Type) a b c.
Zip f =>
(a -> b -> c) -> f a -> f b -> f c
zipWith a -> b -> m c
f f a
a f b
b