Prod
Prod is a Monoid that will combine (2) Numbers under multiplication.
- Source
- Runkit
Implements#
Setoid, Semigroup, Monoid
Construction#
Prod provides multiplication on Numbers and needs to be constructed with
a Number instance. Calling the constructor with a Number, results in a
new Prod that wraps the provided Number.
Passing undefined, NaN or null to the constructor will result in
an empty instance, or an instance containing a 1.
- Source
- Runkit
Constructor Methods#
empty#
empty provides the identity for the Monoid in that when the value it
provides is concated to object other value, it will return the other value.
In the case of Prod the result of empty is 1. empty is available on
both the Constructor and the Instance for convenience.
- Source
- Runkit
Instance Methods#
equals#
Used to compare the underlying values of (2) Prod instances for equality by
value, equals takes any given argument and returns true if the passed argument
is a Prod with an underlying value equal to the underlying value of
the Prod the method is being called on. If the passed argument is not
a Prod or the underlying values are not equal, equals will return false.
- Source
- Runkit
concat#
concat is used to combine (2) Semigroups of the same type under an
operation specified by the Semigroup. In the case of Prod, concat will
multiply the (2) Numbers.
- Source
- Runkit
valueOf#
valueOf is used on all crocks Monoids as a means of extraction. While
the extraction is available, types that implement valueOf are not necessarily
a Comonad. This function is used primarily for convenience for some of the
helper functions that ship with crocks. Calling valueOf on
a Prod instance will result in the underlying Number.
- Source
- Runkit