base-4.16.1.0: Basic libraries
Copyright(c) Nils Schweinsberg 2011
(c) George Giorgidze 2011
(c) University Tuebingen 2011
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Zip

Description

Monadic zipping (used for monad comprehensions)

Synopsis

Documentation

class Monad m => MonadZip m where Source #

Instances should satisfy the laws:

Naturality
liftM (f *** g) (mzip ma mb)
    = mzip (liftM f ma) (liftM g mb)
Information Preservation

liftM (const ()) ma = liftM (const ()) mb implies munzip (mzip ma mb) = (ma, mb)

Minimal complete definition

mzip | mzipWith

Methods

mzip :: m a -> m b -> m (a, b) Source #

mzipWith :: (a -> b -> c) -> m a -> m b -> m c Source #

munzip :: m (a, b) -> (m a, m b) Source #

Instances

Instances details
MonadZip Complex #

Since: base-4.15.0.0

Instance details

Defined in Data.Complex

Methods

mzip :: Complex a -> Complex b -> Complex (a, b) Source #

mzipWith :: (a -> b -> c) -> Complex a -> Complex b -> Complex c Source #

munzip :: Complex (a, b) -> (Complex a, Complex b) Source #

MonadZip Identity #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Identity a -> Identity b -> Identity (a, b) Source #

mzipWith :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source #

munzip :: Identity (a, b) -> (Identity a, Identity b) Source #

MonadZip First #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: First a -> First b -> First (a, b) Source #

mzipWith :: (a -> b -> c) -> First a -> First b -> First c Source #

munzip :: First (a, b) -> (First a, First b) Source #

MonadZip Last #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Last a -> Last b -> Last (a, b) Source #

mzipWith :: (a -> b -> c) -> Last a -> Last b -> Last c Source #

munzip :: Last (a, b) -> (Last a, Last b) Source #

MonadZip Down #

Since: base-4.12.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Down a -> Down b -> Down (a, b) Source #

mzipWith :: (a -> b -> c) -> Down a -> Down b -> Down c Source #

munzip :: Down (a, b) -> (Down a, Down b) Source #

MonadZip Dual #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Dual a -> Dual b -> Dual (a, b) Source #

mzipWith :: (a -> b -> c) -> Dual a -> Dual b -> Dual c Source #

munzip :: Dual (a, b) -> (Dual a, Dual b) Source #

MonadZip Product #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Product a -> Product b -> Product (a, b) Source #

mzipWith :: (a -> b -> c) -> Product a -> Product b -> Product c Source #

munzip :: Product (a, b) -> (Product a, Product b) Source #

MonadZip Sum #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Sum a -> Sum b -> Sum (a, b) Source #

mzipWith :: (a -> b -> c) -> Sum a -> Sum b -> Sum c Source #

munzip :: Sum (a, b) -> (Sum a, Sum b) Source #

MonadZip Par1 #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Par1 a -> Par1 b -> Par1 (a, b) Source #

mzipWith :: (a -> b -> c) -> Par1 a -> Par1 b -> Par1 c Source #

munzip :: Par1 (a, b) -> (Par1 a, Par1 b) Source #

MonadZip NonEmpty #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) Source #

mzipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c Source #

munzip :: NonEmpty (a, b) -> (NonEmpty a, NonEmpty b) Source #

MonadZip Maybe #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Maybe a -> Maybe b -> Maybe (a, b) Source #

mzipWith :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c Source #

munzip :: Maybe (a, b) -> (Maybe a, Maybe b) Source #

MonadZip Solo #

Since: base-4.15.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Solo a -> Solo b -> Solo (a, b) Source #

mzipWith :: (a -> b -> c) -> Solo a -> Solo b -> Solo c Source #

munzip :: Solo (a, b) -> (Solo a, Solo b) Source #

MonadZip [] #

Since: base-4.3.1.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: [a] -> [b] -> [(a, b)] Source #

mzipWith :: (a -> b -> c) -> [a] -> [b] -> [c] Source #

munzip :: [(a, b)] -> ([a], [b]) Source #

MonadZip (Proxy :: Type -> Type) #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Proxy a -> Proxy b -> Proxy (a, b) Source #

mzipWith :: (a -> b -> c) -> Proxy a -> Proxy b -> Proxy c Source #

munzip :: Proxy (a, b) -> (Proxy a, Proxy b) Source #

MonadZip (U1 :: Type -> Type) #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: U1 a -> U1 b -> U1 (a, b) Source #

mzipWith :: (a -> b -> c) -> U1 a -> U1 b -> U1 c Source #

munzip :: U1 (a, b) -> (U1 a, U1 b) Source #

MonadZip f => MonadZip (Alt f) #

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Alt f a -> Alt f b -> Alt f (a, b) Source #

mzipWith :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c Source #

munzip :: Alt f (a, b) -> (Alt f a, Alt f b) Source #

MonadZip f => MonadZip (Rec1 f) #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: Rec1 f a -> Rec1 f b -> Rec1 f (a, b) Source #

mzipWith :: (a -> b -> c) -> Rec1 f a -> Rec1 f b -> Rec1 f c Source #

munzip :: Rec1 f (a, b) -> (Rec1 f a, Rec1 f b) Source #

(MonadZip f, MonadZip g) => MonadZip (Product f g) #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

Methods

mzip :: Product f g a -> Product f g b -> Product f g (a, b) Source #

mzipWith :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c Source #

munzip :: Product f g (a, b) -> (Product f g a, Product f g b) Source #

(MonadZip f, MonadZip g) => MonadZip (f :*: g) #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: (f :*: g) a -> (f :*: g) b -> (f :*: g) (a, b) Source #

mzipWith :: (a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c Source #

munzip :: (f :*: g) (a, b) -> ((f :*: g) a, (f :*: g) b) Source #

MonadZip f => MonadZip (M1 i c f) #

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

mzip :: M1 i c f a -> M1 i c f b -> M1 i c f (a, b) Source #

mzipWith :: (a -> b -> c0) -> M1 i c f a -> M1 i c f b -> M1 i c f c0 Source #

munzip :: M1 i c f (a, b) -> (M1 i c f a, M1 i c f b) Source #