planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Monad.Zip

Synopsis

Documentation

class Monad m => MonadZip (m :: * -> *) where #

MonadZip type class. Minimal definition: mzip or mzipWith

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
==>
munzip (mzip ma mb) = (ma, mb)

Minimal complete definition

mzip | mzipWith

Methods

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

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

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

Instances
MonadZip []

Since: base-4.3.1.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Maybe

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Par1

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Identity

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip First

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Last

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Dual

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Sum

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Product

Since: base-4.8.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip Tree 
Instance details

Defined in Data.Tree

Methods

mzip :: Tree a -> Tree b -> Tree (a, b) #

mzipWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c #

munzip :: Tree (a, b) -> (Tree a, Tree b) #

MonadZip Seq
 mzipWith = zipWith
 munzip = unzip
Instance details

Defined in Data.Sequence.Internal

Methods

mzip :: Seq a -> Seq b -> Seq (a, b) #

mzipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c #

munzip :: Seq (a, b) -> (Seq a, Seq b) #

MonadZip Vector 
Instance details

Defined in Data.Vector

Methods

mzip :: Vector a -> Vector b -> Vector (a, b) #

mzipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c #

munzip :: Vector (a, b) -> (Vector a, Vector b) #

MonadZip SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

mzip :: SmallArray a -> SmallArray b -> SmallArray (a, b) #

mzipWith :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c #

munzip :: SmallArray (a, b) -> (SmallArray a, SmallArray b) #

MonadZip Array 
Instance details

Defined in Data.Primitive.Array

Methods

mzip :: Array a -> Array b -> Array (a, b) #

mzipWith :: (a -> b -> c) -> Array a -> Array b -> Array c #

munzip :: Array (a, b) -> (Array a, Array b) #

MonadZip (U1 :: * -> *)

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip (Proxy :: * -> *)

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Zip

Methods

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

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

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

MonadZip m => MonadZip (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

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

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

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

(Alternative f, MonadZip f) => MonadZip (Cofree f) 
Instance details

Defined in Control.Comonad.Cofree

Methods

mzip :: Cofree f a -> Cofree f b -> Cofree f (a, b) #

mzipWith :: (a -> b -> c) -> Cofree f a -> Cofree f b -> Cofree f c #

munzip :: Cofree f (a, b) -> (Cofree f a, Cofree f b) #

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) #

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

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

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) #

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

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

MonadZip m => MonadZip (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

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

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

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

MonadZip m => MonadZip (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzip :: ExceptT e m a -> ExceptT e m b -> ExceptT e m (a, b) #

mzipWith :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

munzip :: ExceptT e m (a, b) -> (ExceptT e m a, ExceptT e m b) #

(Alternative f, MonadZip f, MonadZip m) => MonadZip (CofreeT f m) 
Instance details

Defined in Control.Comonad.Trans.Cofree

Methods

mzip :: CofreeT f m a -> CofreeT f m b -> CofreeT f m (a, b) #

mzipWith :: (a -> b -> c) -> CofreeT f m a -> CofreeT f m b -> CofreeT f m c #

munzip :: CofreeT f m (a, b) -> (CofreeT f m a, CofreeT f m b) #

(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) #

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

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

(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) #

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

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

MonadZip m => MonadZip (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

mzip :: ReaderT r m a -> ReaderT r m b -> ReaderT r m (a, b) #

mzipWith :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c #

munzip :: ReaderT r m (a, b) -> (ReaderT r m a, ReaderT r m b) #

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) #

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

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