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","")]