-- 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: -- --
-- instance Monoid a => Monoid (Maybe a) where -- mappend (Just x) (Just y) = Just $ x <> y -- mappend (Just x) Nothing = Just x -- mappend Nothing (Just y) = Just y -- mappend Nothing Nothing = Nothing -- -- mempty = Nothing ---- -- Both is a newtype wrapper around Maybe providing this instance: -- --
-- instance Monoid a => Monoid (Both a) where -- mappend (Just x) (Just y) = Just $ x <> y -- mappend _ _ = Nothing -- -- mempty = Just mempty --@package both @version 0.1.1.0 -- | The Both type and operations. Like Maybe, but not. module Data.Both newtype Both a Both :: Maybe a -> Both a [getBoth] :: Both a -> Maybe a -- | The '(<>)' for Maybe is Just if either of -- the operands are, whereas here both must be. -- | The both function takes a default value, a function, and a -- Both value. If the inner Maybe value is Nothing, -- the function returns the default value. Otherwise, it applies the -- function to the value inside the Just and returns the result. both :: b -> (a -> b) -> Both a -> b -- | The fromBoth function takes a default value and a Both -- value. If the inner Maybe is Nothing, it returns the -- default value; otherwise, it returns the value contained within. fromBoth :: a -> Both a -> a instance GHC.Generics.Selector Data.Both.S1_0_0Both instance GHC.Generics.Constructor Data.Both.C1_0Both instance GHC.Generics.Datatype Data.Both.D1Both 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)