-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Safe wrappers for null-partial Foldable operations
--   
--   Safe wrappers for null-partial Foldable operations
@package safe-foldable
@version 0.1.0.0


-- | Safe wrappers for <a>null</a>-partial <a>Foldable</a> operations
--   
--   <pre>
--   &gt;&gt;&gt; minimum []
--   *** Exception: Prelude.minimum: empty list
--   
--   &gt;&gt;&gt; minimum [3,1,2]
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; defaulting 0 minimum []
--   0
--   
--   &gt;&gt;&gt; defaulting 0 minimum [3,1,2]
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; mayhap minimum []
--   Nothing
--   
--   &gt;&gt;&gt; mayhap minimum [3,1,2]
--   Just 1
--   </pre>
module Data.Foldable.Safe

-- | Apply a function to <a>Foldable</a> data if it is not <a>null</a>.
--   Otherwise, return a default value.
defaulting :: Foldable f => b -> (f a -> b) -> f a -> b

-- | Apply a function to <a>Foldable</a> data if it is not <a>null</a>,
--   wrapping the result in <a>Just</a>. Otherwise, return <a>Nothing</a>.
mayhap :: Foldable f => (f a -> b) -> f a -> Maybe b
