barbies-2.0.4.0: Classes for working with types that can change clothes.
Safe Haskell Safe-Inferred
Language Haskell2010

Data.Functor.Prod

Description

Deprecated: The module is no longer part of the main api and will be removed

Generalize the standard two-functor Product to the product of n -functors. Intuitively, this means:

Product f g a ~~ (f a, g a)

Prod '[]        a ~~  Const () a
Prod '[f]       a ~~ (f a)
Prod '[f, g]    a ~~ (f a, g a)
Prod '[f, g, h] a ~~ (f a, g a, h a)
    ⋮
Synopsis

n-tuples of functors.

data Prod :: [k -> Type ] -> k -> Type where Source #

Product of n functors.

Constructors

Unit :: Prod '[] a
Cons :: f a -> Prod fs a -> Prod (f ': fs) a

Instances

Instances details
( Functor f, Functor ( Prod fs)) => Functor ( Prod (f ': fs)) Source #

Inductively defined instance: Functor ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

fmap :: (a -> b) -> Prod (f ': fs) a -> Prod (f ': fs) b Source #

(<$) :: a -> Prod (f ': fs) b -> Prod (f ': fs) a Source #

Functor ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Functor ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

Methods

fmap :: (a -> b) -> Prod '[] a -> Prod '[] b Source #

(<$) :: a -> Prod '[] b -> Prod '[] a Source #

( Applicative f, Applicative ( Prod fs)) => Applicative ( Prod (f ': fs)) Source #

Inductively defined instance: Applicative ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

pure :: a -> Prod (f ': fs) a Source #

(<*>) :: Prod (f ': fs) (a -> b) -> Prod (f ': fs) a -> Prod (f ': fs) b Source #

liftA2 :: (a -> b -> c) -> Prod (f ': fs) a -> Prod (f ': fs) b -> Prod (f ': fs) c Source #

(*>) :: Prod (f ': fs) a -> Prod (f ': fs) b -> Prod (f ': fs) b Source #

(<*) :: Prod (f ': fs) a -> Prod (f ': fs) b -> Prod (f ': fs) a Source #

Applicative ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Applicative ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

Methods

pure :: a -> Prod '[] a Source #

(<*>) :: Prod '[] (a -> b) -> Prod '[] a -> Prod '[] b Source #

liftA2 :: (a -> b -> c) -> Prod '[] a -> Prod '[] b -> Prod '[] c Source #

(*>) :: Prod '[] a -> Prod '[] b -> Prod '[] b Source #

(<*) :: Prod '[] a -> Prod '[] b -> Prod '[] a Source #

( Foldable f, Foldable ( Prod fs)) => Foldable ( Prod (f ': fs)) Source #

Inductively defined instance: Foldable ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

fold :: Monoid m => Prod (f ': fs) m -> m Source #

foldMap :: Monoid m => (a -> m) -> Prod (f ': fs) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Prod (f ': fs) a -> m Source #

foldr :: (a -> b -> b) -> b -> Prod (f ': fs) a -> b Source #

foldr' :: (a -> b -> b) -> b -> Prod (f ': fs) a -> b Source #

foldl :: (b -> a -> b) -> b -> Prod (f ': fs) a -> b Source #

foldl' :: (b -> a -> b) -> b -> Prod (f ': fs) a -> b Source #

foldr1 :: (a -> a -> a) -> Prod (f ': fs) a -> a Source #

foldl1 :: (a -> a -> a) -> Prod (f ': fs) a -> a Source #

toList :: Prod (f ': fs) a -> [a] Source #

null :: Prod (f ': fs) a -> Bool Source #

length :: Prod (f ': fs) a -> Int Source #

elem :: Eq a => a -> Prod (f ': fs) a -> Bool Source #

maximum :: Ord a => Prod (f ': fs) a -> a Source #

minimum :: Ord a => Prod (f ': fs) a -> a Source #

sum :: Num a => Prod (f ': fs) a -> a Source #

product :: Num a => Prod (f ': fs) a -> a Source #

Foldable ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Foldable ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

Methods

fold :: Monoid m => Prod '[] m -> m Source #

foldMap :: Monoid m => (a -> m) -> Prod '[] a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Prod '[] a -> m Source #

foldr :: (a -> b -> b) -> b -> Prod '[] a -> b Source #

foldr' :: (a -> b -> b) -> b -> Prod '[] a -> b Source #

foldl :: (b -> a -> b) -> b -> Prod '[] a -> b Source #

foldl' :: (b -> a -> b) -> b -> Prod '[] a -> b Source #

foldr1 :: (a -> a -> a) -> Prod '[] a -> a Source #

foldl1 :: (a -> a -> a) -> Prod '[] a -> a Source #

toList :: Prod '[] a -> [a] Source #

null :: Prod '[] a -> Bool Source #

length :: Prod '[] a -> Int Source #

elem :: Eq a => a -> Prod '[] a -> Bool Source #

maximum :: Ord a => Prod '[] a -> a Source #

minimum :: Ord a => Prod '[] a -> a Source #

sum :: Num a => Prod '[] a -> a Source #

product :: Num a => Prod '[] a -> a Source #

( Traversable f, Traversable ( Prod fs)) => Traversable ( Prod (f ': fs)) Source #

Inductively defined instance: Traversable ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Prod (f ': fs) a -> f0 ( Prod (f ': fs) b) Source #

sequenceA :: Applicative f0 => Prod (f ': fs) (f0 a) -> f0 ( Prod (f ': fs) a) Source #

mapM :: Monad m => (a -> m b) -> Prod (f ': fs) a -> m ( Prod (f ': fs) b) Source #

sequence :: Monad m => Prod (f ': fs) (m a) -> m ( Prod (f ': fs) a) Source #

Traversable ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Traversable ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

Methods

traverse :: Applicative f => (a -> f b) -> Prod '[] a -> f ( Prod '[] b) Source #

sequenceA :: Applicative f => Prod '[] (f a) -> f ( Prod '[] a) Source #

mapM :: Monad m => (a -> m b) -> Prod '[] a -> m ( Prod '[] b) Source #

sequence :: Monad m => Prod '[] (m a) -> m ( Prod '[] a) Source #

( Eq1 f, Eq1 ( Prod fs)) => Eq1 ( Prod (f ': fs)) Source #

Inductively defined instance: Eq1 ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

liftEq :: (a -> b -> Bool ) -> Prod (f ': fs) a -> Prod (f ': fs) b -> Bool Source #

Eq1 ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Eq1 ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

Methods

liftEq :: (a -> b -> Bool ) -> Prod '[] a -> Prod '[] b -> Bool Source #

( Ord1 f, Ord1 ( Prod fs)) => Ord1 ( Prod (f ': fs)) Source #

Inductively defined instance: Ord1 ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

liftCompare :: (a -> b -> Ordering ) -> Prod (f ': fs) a -> Prod (f ': fs) b -> Ordering Source #

Ord1 ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Ord1 ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

Methods

liftCompare :: (a -> b -> Ordering ) -> Prod '[] a -> Prod '[] b -> Ordering Source #

( Show1 f, Show1 ( Prod fs)) => Show1 ( Prod (f ': fs)) Source #

Inductively defined instance: Show1 ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

liftShowsPrec :: ( Int -> a -> ShowS ) -> ([a] -> ShowS ) -> Int -> Prod (f ': fs) a -> ShowS Source #

liftShowList :: ( Int -> a -> ShowS ) -> ([a] -> ShowS ) -> [ Prod (f ': fs) a] -> ShowS Source #

Show1 ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Show1 ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

( Alternative f, Alternative ( Prod fs)) => Alternative ( Prod (f ': fs)) Source #

Inductively defined instance: Alternative ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

empty :: Prod (f ': fs) a Source #

(<|>) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Prod (f ': fs) a Source #

some :: Prod (f ': fs) a -> Prod (f ': fs) [a] Source #

many :: Prod (f ': fs) a -> Prod (f ': fs) [a] Source #

Alternative ( Prod ('[] :: [ Type -> Type ])) Source #

Inductively defined instance: Alternative ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

( Eq1 f, Eq a, Eq1 ( Prod fs)) => Eq ( Prod (f ': fs) a) Source #

Inductively defined instance: Eq ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

(==) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Bool Source #

(/=) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Bool Source #

Eq a => Eq ( Prod ('[] :: [ Type -> Type ]) a) Source #

Inductively defined instance: Eq ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

( Ord1 f, Ord a, Ord1 ( Prod fs)) => Ord ( Prod (f ': fs) a) Source #

Inductively defined instance: Ord ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Methods

compare :: Prod (f ': fs) a -> Prod (f ': fs) a -> Ordering Source #

(<) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Bool Source #

(<=) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Bool Source #

(>) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Bool Source #

(>=) :: Prod (f ': fs) a -> Prod (f ': fs) a -> Bool Source #

max :: Prod (f ': fs) a -> Prod (f ': fs) a -> Prod (f ': fs) a Source #

min :: Prod (f ': fs) a -> Prod (f ': fs) a -> Prod (f ': fs) a Source #

Ord a => Ord ( Prod ('[] :: [ Type -> Type ]) a) Source #

Inductively defined instance: Ord ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

( Show1 f, Show a, Show1 ( Prod fs)) => Show ( Prod (f ': fs) a) Source #

Inductively defined instance: Show ( Prod (f ': fs)) .

Instance details

Defined in Data.Functor.Prod

Show a => Show ( Prod ('[] :: [ Type -> Type ]) a) Source #

Inductively defined instance: Show ( Prod '[]) .

Instance details

Defined in Data.Functor.Prod

zeroTuple :: Prod '[] a Source #

The unit of the product.

oneTuple :: f a -> Prod '[f] a Source #

Lift a functor to a 1-tuple.

fromProduct :: Product f g a -> Prod '[f, g] a Source #

Conversion from a standard Product

toProduct :: Prod '[f, g] a -> Product f g a Source #

Conversion to a standard Product

Flat product of functor products

prod :: Prod ls a -> Prod rs a -> Prod (ls ++ rs) a Source #

Flat product of products.

Lifting functions

uncurryn :: Curried ( Prod fs a -> r a) -> Prod fs a -> r a Source #

Like uncurry but using Prod instead of pairs. Can be thought of as a family of functions:

uncurryn :: r a -> Prod '[] a
uncurryn :: (f a -> r a) -> Prod '[f] a
uncurryn :: (f a -> g a -> r a) -> Prod '[f, g] a
uncurryn :: (f a -> g a -> h a -> r a) -> Prod '[f, g, h] a
        ⋮

Type-level helpers

type family l ++ r :: [k] where ... Source #

Type-level, poly-kinded, list-concatenation.

Equations

'[] ++ ys = ys
(x ': xs) ++ ys = x ': (xs ++ ys)

type family Curried t where ... Source #

Prod '[f, g, h] a -> r is the type of the uncurried form of a function f a -> g a -> h a -> r . Curried moves from the former to the later. E.g.

Curried (Prod '[]  a    -> r) = r a
Curried (Prod '[f] a    -> r) = f a -> r a
Curried (Prod '[f, g] a -> r) = f a -> g a -> r a

Equations

Curried ( Prod '[] a -> r a) = r a
Curried ( Prod (f ': fs) a -> r a) = f a -> Curried ( Prod fs a -> r a)