data-extra-2.4.0: Extra utilities for working on Data.* types.
Data.Maybe.Extra
Description
Extra functions for dealing with Maybe.
Synopsis
whenMaybe :: Monad m => Bool -> m a -> m (Maybe a)Source
When the predicate is true, return maybe the action's return value.
whenJust :: Monad m => Maybe a -> (a -> m c) -> m ()Source
When a value is Just, do something with it, monadically.
sole :: [a] -> Maybe aSource
Return the sole element of the list or nothing.