base-4.10.1.0: Basic libraries

Copyright | (c) Ross Paterson 2014
License | BSD-style (see the file LICENSE)
Maintainer | libraries@haskell.org
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Data.Functor.Sum

Description

Sums, lifted to functors.

Since: 4.9.0.0

Synopsis

- data Sum f g a
  - = InL (f a)
  - | InR (g a)

# Documentation

data Sum f g a #

Lifted sum of functors.

Constructors

InL (f a) |
InR (g a) |

Instances

Generic1 k (Sum k f g) # |
Associated Types type Rep1 (Sum k f g) (f :: Sum k f g -> *) :: k -> * # Methods from1 :: f a -> Rep1 (Sum k f g) f a # to1 :: Rep1 (Sum k f g) f a -> f a #
(Functor f, Functor g) => Functor (Sum * f g) # | Since: 4.9.0.0
Methods fmap :: (a -> b) -> Sum * f g a -> Sum * f g b # (<$) :: a -> Sum * f g b -> Sum * f g a #
(Foldable f, Foldable g) => Foldable (Sum * f g) # | Since: 4.9.0.0

Methods

fold :: Monoid m => Sum * f g m -> m #

foldMap :: Monoid m => (a -> m) -> Sum * f g a -> m #

foldr :: (a -> b -> b) -> b -> Sum * f g a -> b #

foldr' :: (a -> b -> b) -> b -> Sum * f g a -> b #

foldl :: (b -> a -> b) -> b -> Sum * f g a -> b #

foldl' :: (b -> a -> b) -> b -> Sum * f g a -> b #

foldr1 :: (a -> a -> a) -> Sum * f g a -> a #

foldl1 :: (a -> a -> a) -> Sum * f g a -> a #

toList :: Sum * f g a -> [a] #

null :: Sum * f g a -> Bool #

length :: Sum * f g a -> Int #

elem :: Eq a => a -> Sum * f g a -> Bool #

maximum :: Ord a => Sum * f g a -> a #

minimum :: Ord a => Sum * f g a -> a #

sum :: Num a => Sum * f g a -> a #

product :: Num a => Sum * f g a -> a #

(Traversable f, Traversable g) => Traversable (Sum * f g) # | Since: 4.9.0.0
Methods traverse :: Applicative f => (a -> f b) -> Sum * f g a -> f (Sum * f g b) # sequenceA :: Applicative f => Sum * f g (f a) -> f (Sum * f g a) # mapM :: Monad m => (a -> m b) -> Sum * f g a -> m (Sum * f g b) # sequence :: Monad m => Sum * f g (m a) -> m (Sum * f g a) #
(Show1 f, Show1 g) => Show1 (Sum * f g) # | Since: 4.9.0.0
Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Sum * f g a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Sum * f g a] -> ShowS #
(Read1 f, Read1 g) => Read1 (Sum * f g) # | Since: 4.9.0.0
Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Sum * f g a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Sum * f g a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Sum * f g a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Sum * f g a] #
(Ord1 f, Ord1 g) => Ord1 (Sum * f g) # | Since: 4.9.0.0
Methods liftCompare :: (a -> b -> Ordering) -> Sum * f g a -> Sum * f g b -> Ordering #
(Eq1 f, Eq1 g) => Eq1 (Sum * f g) # | Since: 4.9.0.0
Methods liftEq :: (a -> b -> Bool) -> Sum * f g a -> Sum * f g b -> Bool #
(Eq1 f, Eq1 g, Eq a) => Eq (Sum * f g a) # | Since: 4.9.0.0
Methods (==) :: Sum * f g a -> Sum * f g a -> Bool Source # (/=) :: Sum * f g a -> Sum * f g a -> Bool Source #
(Data (g a), Data (f a), Typeable * k, Typeable (k -> *) g, Typeable (k -> *) f, Typeable k a) => Data (Sum k f g a) # |

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall b. b -> c b) -> Sum k f g a -> c (Sum k f g a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Sum k f g a) #

toConstr :: Sum k f g a -> Constr #

dataTypeOf :: Sum k f g a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Sum k f g a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Sum k f g a)) #

gmapT :: (forall b. Data b => b -> b) -> Sum k f g a -> Sum k f g a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Sum k f g a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Sum k f g a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Sum k f g a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Sum k f g a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Sum k f g a -> m (Sum k f g a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum k f g a -> m (Sum k f g a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum k f g a -> m (Sum k f g a) #

(Ord1 f, Ord1 g, Ord a) => Ord (Sum * f g a) # | Since: 4.9.0.0
Methods compare :: Sum * f g a -> Sum * f g a -> Ordering Source # (<) :: Sum * f g a -> Sum * f g a -> Bool Source # (<=) :: Sum * f g a -> Sum * f g a -> Bool Source # (>) :: Sum * f g a -> Sum * f g a -> Bool Source # (>=) :: Sum * f g a -> Sum * f g a -> Bool Source # max :: Sum * f g a -> Sum * f g a -> Sum * f g a Source # min :: Sum * f g a -> Sum * f g a -> Sum * f g a Source #
(Read1 f, Read1 g, Read a) => Read (Sum * f g a) # | Since: 4.9.0.0
Methods readsPrec :: Int -> ReadS (Sum * f g a) # readList :: ReadS [Sum * f g a] # readPrec :: ReadPrec (Sum * f g a) # readListPrec :: ReadPrec [Sum * f g a] #
(Show1 f, Show1 g, Show a) => Show (Sum * f g a) # | Since: 4.9.0.0
Methods showsPrec :: Int -> Sum * f g a -> ShowS # show :: Sum * f g a -> String # showList :: [Sum * f g a] -> ShowS #
Generic (Sum k f g a) # |
Associated Types type Rep (Sum k f g a) :: * -> * # Methods from :: Sum k f g a -> Rep (Sum k f g a) x # to :: Rep (Sum k f g a) x -> Sum k f g a #
type Rep1 k (Sum k f g) # |
type Rep1 k (Sum k f g) = D1 k (MetaData "Sum" "Data.Functor.Sum" "base" False) ((:+:) k (C1 k (MetaCons "InL" PrefixI False) (S1 k (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 k f))) (C1 k (MetaCons "InR" PrefixI False) (S1 k (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 k g))))
type Rep (Sum k f g a) # |
type Rep (Sum k f g a) = D1 * (MetaData "Sum" "Data.Functor.Sum" "base" False) ((:+:) * (C1 * (MetaCons "InL" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (f a)))) (C1 * (MetaCons "InR" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (g a)))))