Bug1004

Safe Haskell | Safe-Inferred
Language | Haskell2010

Bug1004

Synopsis

- data Product (f :: k -> Type) (g :: k -> Type) (a :: k) = Pair (f a) (g a)

# Documentation

data Product (f :: k -> Type) (g :: k -> Type) (a :: k) #

Lifted product of functors.

#### Examples

Expand

    >>> fmap (+1) (Pair [1, 2, 3] (Just 0))
    Pair [2,3,4] (Just 1)

    >>> Pair "Hello, " (Left 'x') <> Pair "World" (Right 'y')
    Pair "Hello, World" (Right 'y')

Constructors

Pair (f a) (g a) |

#### Instances

Instances details

Generic1 (Product f g :: k -> Type) |
Instance details Defined in Data.Functor.Product Associated Types
type Rep1 (Product f g :: k -> Type) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product type Rep1 (Product f g :: k -> Type) = D1 ('MetaData "Product" "Data.Functor.Product" "base" 'False) (C1 ('MetaCons "Pair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g)))
Methods from1 :: forall (a :: k). Product f g a -> Rep1 (Product f g) a # to1 :: forall (a :: k). Rep1 (Product f g) a -> Product f g a #
(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) #
(Foldable1 f, Foldable1 g) => Foldable1 (Product f g) | It would be enough for either half of a product to be `Foldable1`. Other could be `Foldable`.
Instance details Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Product f g m -> m # foldMap1 :: Semigroup m => (a -> m) -> Product f g a -> m # foldMap1' :: Semigroup m => (a -> m) -> Product f g a -> m # toNonEmpty :: Product f g a -> NonEmpty a # maximum :: Ord a => Product f g a -> a # minimum :: Ord a => Product f g a -> a # head :: Product f g a -> a # last :: Product f g a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> Product f g a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> Product f g a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> Product f g a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> Product f g a -> b #
(Eq1 f, Eq1 g) => Eq1 (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods liftEq :: (a -> b -> Bool) -> Product f g a -> Product f g b -> Bool #
(Ord1 f, Ord1 g) => Ord1 (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods liftCompare :: (a -> b -> Ordering) -> Product f g a -> Product f g b -> Ordering #
(Read1 f, Read1 g) => Read1 (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Product f g a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Product f g a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Product f g a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Product f g a] #
(Show1 f, Show1 g) => Show1 (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Product f g a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Product f g a] -> ShowS #
(Contravariant f, Contravariant g) => Contravariant (Product f g) |
Instance details Defined in Data.Functor.Contravariant Methods contramap :: (a' -> a) -> Product f g a -> Product f g a' # (>$) :: b -> Product f g b -> Product f g a #
(NFData1 f, NFData1 g) => NFData1 (Product f g) | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> Product f g a -> () #
(Alternative f, Alternative g) => Alternative (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods empty :: Product f g a # (<|>) :: Product f g a -> Product f g a -> Product f g a # some :: Product f g a -> Product f g [a] # many :: Product f g a -> Product f g [a] #
(Applicative f, Applicative g) => Applicative (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods pure :: a -> Product f g a # (<*>) :: Product f g (a -> b) -> Product f g a -> Product f g b # liftA2 :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c # (*>) :: Product f g a -> Product f g b -> Product f g b # (<*) :: Product f g a -> Product f g b -> Product f g a #
(Functor f, Functor g) => Functor (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods fmap :: (a -> b) -> Product f g a -> Product f g b # (<$) :: a -> Product f g b -> Product f g a #
(Monad f, Monad g) => Monad (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods (>>=) :: Product f g a -> (a -> Product f g b) -> Product f g b # (>>) :: Product f g a -> Product f g b -> Product f g b # return :: a -> Product f g a #
(MonadPlus f, MonadPlus g) => MonadPlus (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods mzero :: Product f g a # mplus :: Product f g a -> Product f g a -> Product f g a #
(MonadFix f, MonadFix g) => MonadFix (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods mfix :: (a -> Product f g a) -> Product f g a #
(Foldable f, Foldable g) => Foldable (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods fold :: Monoid m => Product f g m -> m # foldMap :: Monoid m => (a -> m) -> Product f g a -> m # foldMap' :: Monoid m => (a -> m) -> Product f g a -> m # foldr :: (a -> b -> b) -> b -> Product f g a -> b # foldr' :: (a -> b -> b) -> b -> Product f g a -> b # foldl :: (b -> a -> b) -> b -> Product f g a -> b # foldl' :: (b -> a -> b) -> b -> Product f g a -> b # foldr1 :: (a -> a -> a) -> Product f g a -> a # foldl1 :: (a -> a -> a) -> Product f g a -> a # toList :: Product f g a -> [a] # null :: Product f g a -> Bool # length :: Product f g a -> Int # elem :: Eq a => a -> Product f g a -> Bool # maximum :: Ord a => Product f g a -> a # minimum :: Ord a => Product f g a -> a # sum :: Num a => Product f g a -> a # product :: Num a => Product f g a -> a #
(Traversable f, Traversable g) => Traversable (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods traverse :: Applicative f0 => (a -> f0 b) -> Product f g a -> f0 (Product f g b) # sequenceA :: Applicative f0 => Product f g (f0 a) -> f0 (Product f g a) # mapM :: Monad m => (a -> m b) -> Product f g a -> m (Product f g b) # sequence :: Monad m => Product f g (m a) -> m (Product f g a) #
(NFData (f a), NFData (g a)) => NFData (Product f g a) | Note: in `deepseq-1.5.0.0` this instance's superclasses were changed. Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: Product f g a -> () #
(Monoid (f a), Monoid (g a)) => Monoid (Product f g a) | Since: base-4.16.0.0
Instance details Defined in Data.Functor.Product Methods mempty :: Product f g a # mappend :: Product f g a -> Product f g a -> Product f g a # mconcat :: [Product f g a] -> Product f g a #
(Semigroup (f a), Semigroup (g a)) => Semigroup (Product f g a) | Since: base-4.16.0.0
Instance details Defined in Data.Functor.Product Methods (<>) :: Product f g a -> Product f g a -> Product f g a # sconcat :: NonEmpty (Product f g a) -> Product f g a # stimes :: Integral b => b -> Product f g a -> Product f g a #
(Typeable a, Typeable f, Typeable g, Typeable k, Data (f a), Data (g a)) => Data (Product f g a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Product f g a -> c (Product f g a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Product f g a) # toConstr :: Product f g a -> Constr # dataTypeOf :: Product f g a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Product f g a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Product f g a)) # gmapT :: (forall b. Data b => b -> b) -> Product f g a -> Product f g a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Product f g a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Product f g a -> r # gmapQ :: (forall d. Data d => d -> u) -> Product f g a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Product f g a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Product f g a -> m (Product f g a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Product f g a -> m (Product f g a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Product f g a -> m (Product f g a) #
Generic (Product f g a) |
Instance details Defined in Data.Functor.Product Associated Types
type Rep (Product f g a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product type Rep (Product f g a) = D1 ('MetaData "Product" "Data.Functor.Product" "base" 'False) (C1 ('MetaCons "Pair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g a))))
Methods from :: Product f g a -> Rep (Product f g a) x # to :: Rep (Product f g a) x -> Product f g a #
(Read (f a), Read (g a)) => Read (Product f g a) | Since: base-4.18.0.0
Instance details Defined in Data.Functor.Product Methods readsPrec :: Int -> ReadS (Product f g a) # readList :: ReadS [Product f g a] # readPrec :: ReadPrec (Product f g a) # readListPrec :: ReadPrec [Product f g a] #
(Show (f a), Show (g a)) => Show (Product f g a) | Since: base-4.18.0.0
Instance details Defined in Data.Functor.Product Methods showsPrec :: Int -> Product f g a -> ShowS # show :: Product f g a -> String # showList :: [Product f g a] -> ShowS #
(Eq (f a), Eq (g a)) => Eq (Product f g a) | Since: base-4.18.0.0
Instance details Defined in Data.Functor.Product Methods (==) :: Product f g a -> Product f g a -> Bool # (/=) :: Product f g a -> Product f g a -> Bool #
(Ord (f a), Ord (g a)) => Ord (Product f g a) | Since: base-4.18.0.0
Instance details Defined in Data.Functor.Product Methods compare :: Product f g a -> Product f g a -> Ordering # (<) :: Product f g a -> Product f g a -> Bool # (<=) :: Product f g a -> Product f g a -> Bool # (>) :: Product f g a -> Product f g a -> Bool # (>=) :: Product f g a -> Product f g a -> Bool # max :: Product f g a -> Product f g a -> Product f g a # min :: Product f g a -> Product f g a -> Product f g a #
type Rep1 (Product f g :: k -> Type) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product type Rep1 (Product f g :: k -> Type) = D1 ('MetaData "Product" "Data.Functor.Product" "base" 'False) (C1 ('MetaCons "Pair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g)))
type Rep (Product f g a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product type Rep (Product f g a) = D1 ('MetaData "Product" "Data.Functor.Product" "base" 'False) (C1 ('MetaCons "Pair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g a))))