base-4.9.0.0: Basic libraries

Copyright(c) Ross Paterson 2014
LicenseBSD-style (see the file LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Functor.Sum

Description

Sums, lifted to functors.

Since: 4.9.0.0

Synopsis

Documentation

data Sum f g a Source

Lifted sum of functors.

Constructors

InL (f a) 
InR (g a) 

Instances

(Functor f, Functor g) => Functor (Sum (TYPE Lifted) f g) 

Methods

fmap :: (a -> b) -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g b Source

(<$) :: a -> Sum (TYPE Lifted) f g b -> Sum (TYPE Lifted) f g a Source

(Foldable f, Foldable g) => Foldable (Sum (TYPE Lifted) f g) 

Methods

fold :: Monoid m => Sum (TYPE Lifted) f g m -> m Source

foldMap :: Monoid m => (a -> m) -> Sum (TYPE Lifted) f g a -> m Source

foldr :: (a -> b -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldr' :: (a -> b -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldl :: (b -> a -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldl' :: (b -> a -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldr1 :: (a -> a -> a) -> Sum (TYPE Lifted) f g a -> a Source

foldl1 :: (a -> a -> a) -> Sum (TYPE Lifted) f g a -> a Source

toList :: Sum (TYPE Lifted) f g a -> [a] Source

null :: Sum (TYPE Lifted) f g a -> Bool Source

length :: Sum (TYPE Lifted) f g a -> Int Source

elem :: Eq a => a -> Sum (TYPE Lifted) f g a -> Bool Source

maximum :: Ord a => Sum (TYPE Lifted) f g a -> a Source

minimum :: Ord a => Sum (TYPE Lifted) f g a -> a Source

sum :: Num a => Sum (TYPE Lifted) f g a -> a Source

product :: Num a => Sum (TYPE Lifted) f g a -> a Source

(Traversable f, Traversable g) => Traversable (Sum (TYPE Lifted) f g) 

Methods

traverse :: Applicative f => (a -> f b) -> Sum (TYPE Lifted) f g a -> f (Sum (TYPE Lifted) f g b) Source

sequenceA :: Applicative f => Sum (TYPE Lifted) f g (f a) -> f (Sum (TYPE Lifted) f g a) Source

mapM :: Monad m => (a -> m b) -> Sum (TYPE Lifted) f g a -> m (Sum (TYPE Lifted) f g b) Source

sequence :: Monad m => Sum (TYPE Lifted) f g (m a) -> m (Sum (TYPE Lifted) f g a) Source

Generic1 (Sum (TYPE Lifted) f g) 

Associated Types

type Rep1 (Sum (TYPE Lifted) f g :: * -> TYPE Lifted) :: * -> * Source

Methods

from1 :: Sum (TYPE Lifted) f g a -> Rep1 (Sum (TYPE Lifted) f g) a Source

to1 :: Rep1 (Sum (TYPE Lifted) f g) a -> Sum (TYPE Lifted) f g a Source

(Show1 f, Show1 g) => Show1 (Sum (TYPE Lifted) f g) 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Sum (TYPE Lifted) f g a -> ShowS Source

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Sum (TYPE Lifted) f g a] -> ShowS Source

(Read1 f, Read1 g) => Read1 (Sum (TYPE Lifted) f g) 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Sum (TYPE Lifted) f g a) Source

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Sum (TYPE Lifted) f g a] Source

(Ord1 f, Ord1 g) => Ord1 (Sum (TYPE Lifted) f g) 

Methods

liftCompare :: (a -> b -> Ordering) -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g b -> Ordering Source

(Eq1 f, Eq1 g) => Eq1 (Sum (TYPE Lifted) f g) 

Methods

liftEq :: (a -> b -> Bool) -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g b -> Bool Source

(Eq1 f, Eq1 g, Eq a) => Eq (Sum (TYPE Lifted) f g a) 

Methods

(==) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(/=) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(Data (f a), Data (g a), Typeable k a, Typeable (TYPE Lifted) k, Typeable (k -> TYPE Lifted) f, Typeable (k -> TYPE Lifted) g) => 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) Source

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

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

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

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

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

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

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

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

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

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

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

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

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

(Ord1 f, Ord1 g, Ord a) => Ord (Sum (TYPE Lifted) f g a) 

Methods

compare :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Ordering Source

(<) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(<=) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(>) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(>=) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

max :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a Source

min :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a Source

(Read1 f, Read1 g, Read a) => Read (Sum (TYPE Lifted) f g a) 
(Show1 f, Show1 g, Show a) => Show (Sum (TYPE Lifted) f g a) 

Methods

showsPrec :: Int -> Sum (TYPE Lifted) f g a -> ShowS Source

show :: Sum (TYPE Lifted) f g a -> String Source

showList :: [Sum (TYPE Lifted) f g a] -> ShowS Source

Generic (Sum k f g a) 

Associated Types

type Rep (Sum k f g a) :: * -> * Source

Methods

from :: Sum k f g a -> Rep (Sum k f g a) x Source

to :: Rep (Sum k f g a) x -> Sum k f g a Source

type Rep1 (Sum k f g) = D1 (MetaData "Sum" "Data.Functor.Sum" "base" False) ((:+:) (C1 (MetaCons "InL" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f))) (C1 (MetaCons "InR" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g)))) 
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)))))