Product package:base

Products, lifted to functors.
Lifted product of functors.

Examples

>>> 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')
Monoid under multiplication.
Product x <> Product y == Product (x * y)

Examples

>>> Product 3 <> Product 4 <> mempty
Product {getProduct = 12}
>>> mconcat [ Product n | n <- [2 .. 10]]
Product {getProduct = 3628800}
The product function computes the product of the numbers of a structure.

Examples

Basic usage:
>>> product []
1
>>> product [42]
42
>>> product [1..10]
3628800
>>> product [4.1, 2.0, 1.7]
13.939999999999998
>>> product [1..]
* Hangs forever *
The product function computes the product of a finite list of numbers.
>>> product []
1

>>> product [42]
42

>>> product [1..10]
3628800

>>> product [4.1, 2.0, 1.7]
13.939999999999998

>>> product [1..]
* Hangs forever *
The biproduct function computes the product of the numbers of a structure.

Examples

Basic usage:
>>> biproduct (42, 17)
714
>>> biproduct (Right 42)
42
>>> biproduct (BiList [13, 29, 4] [18, 1, 7])
190008
>>> biproduct (BiList [13, 29, 4] [])
1508
>>> biproduct (BiList [] [])
1