:: a -> Maybe a -> a -package:stack -package:incipit-base package:ghc

Flipped version of fromMaybe, useful for chaining.
Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

Examples

Perform a computation with Maybe and replace the result with a constant value if it is Just:
>>> 'a' <$ Just 2
Just 'a'

>>> 'a' <$ Nothing
Nothing