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


-- | Like Maybe, but with a different Monoid instance.
--   
--   The Monoid instance for Maybe behaves like so:
--   
--   <pre>
--   instance Monoid a =&gt; Monoid (Maybe a) where
--     mappend (Just x) (Just y) = Just $ x &lt;&gt; y
--     mappend (Just x) Nothing  = Just x
--     mappend Nothing  (Just y) = Just y
--     mappend Nothing  Nothing  = Nothing
--   
--     mempty = Nothing
--   </pre>
--   
--   Both is a newtype wrapper around Maybe providing this instance:
--   
--   <pre>
--   instance Monoid a =&gt; Monoid (Both a) where
--     mappend (Just x) (Just y) = Just $ x &lt;&gt; y
--     mappend _ _ = Nothing
--   
--     mempty = Just mempty
--   </pre>
@package both
@version 0.1.1.0


-- | The <a>Both</a> type and operations. Like <a>Maybe</a>, but not.
module Data.Both
newtype Both a
Both :: Maybe a -> Both a
[getBoth] :: Both a -> Maybe a

-- | The '(&lt;&gt;)' for <a>Maybe</a> is <a>Just</a> if <i>either</i> of
--   the operands are, whereas here <i>both</i> must be.

-- | The <a>both</a> function takes a default value, a function, and a
--   <a>Both</a> value. If the inner <a>Maybe</a> value is <a>Nothing</a>,
--   the function returns the default value. Otherwise, it applies the
--   function to the value inside the <a>Just</a> and returns the result.
both :: b -> (a -> b) -> Both a -> b

-- | The <a>fromBoth</a> function takes a default value and a <a>Both</a>
--   value. If the inner <a>Maybe</a> is <a>Nothing</a>, it returns the
--   default value; otherwise, it returns the value contained within.
fromBoth :: a -> Both a -> a
instance Data.Traversable.Traversable Data.Both.Both
instance Data.Foldable.Foldable Data.Both.Both
instance GHC.Base.MonadPlus Data.Both.Both
instance GHC.Base.Monad Data.Both.Both
instance GHC.Base.Alternative Data.Both.Both
instance GHC.Base.Applicative Data.Both.Both
instance GHC.Base.Functor Data.Both.Both
instance GHC.Generics.Generic1 Data.Both.Both
instance GHC.Generics.Generic (Data.Both.Both a)
instance Data.Data.Data a => Data.Data.Data (Data.Both.Both a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Both.Both a)
instance GHC.Read.Read a => GHC.Read.Read (Data.Both.Both a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Both.Both a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Both.Both a)
instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Both.Both a)
instance (GHC.Base.Monoid a, Data.Semigroup.Semigroup a) => GHC.Base.Monoid (Data.Both.Both a)
instance Data.Semigroup.Semigroup a => Data.Zero.Zero (Data.Both.Both a)
