* package:dimensional

Multiplication of dimensions corresponds to addition of the base dimensions' exponents.
Multiplies two Quantitys or two Units. The intimidating type signature captures the similarity between these operations and ensures that composite Units are NonMetric.
Forms the product of two dimensions.
Forms the product of two dynamic units.
Form a UnitName by taking the product of two others.
Forms the product of two Variants. The product of units is a non-metric unit. The product of quantities is a quantity.
Raises a dimensionless quantity to a dimensionless power.
Forms a Quantity by multipliying a number and a unit.
Applies *~ to all values in a functor.
Forms a dynamic quantity by multipliying a number and a dynamic unit.
Forms a possibly scaled SQuantity by multipliying a number and a unit.
Applies *~ to all values in a functor.
Sequence actions, discarding the value of the first argument.

Examples

If used in conjunction with the Applicative instance for Maybe, you can chain Maybe computations, with a possible "early return" in case of Nothing.
>>> Just 2 *> Just 3
Just 3
>>> Nothing *> Just 3
Nothing
Of course a more interesting use case would be to have effectful computations instead of just returning pure values.
>>> import Data.Char

>>> import Text.ParserCombinators.ReadP

>>> let p = string "my name is " *> munch1 isAlpha <* eof

>>> readP_to_S p "my name is Simon"
[("Simon","")]
Sequence actions, discarding the value of the second argument.
Sequential application. A few functors support an implementation of <*> that is more efficient than the default one.

Example

Used in combination with (<$>), (<*>) can be used to build a record.
>>> data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
>>> produceFoo :: Applicative f => f Foo
>>> produceBar :: Applicative f => f Bar

>>> produceBaz :: Applicative f => f Baz
>>> mkState :: Applicative f => f MyState

>>> mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz