base-4.21.0.0: Core data structures and operations
Copyright(c) Ross Paterson 2010
LicenseBSD-style (see the file LICENSE)
Maintainerlibraries@haskell.org
Stabilitystable
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Functor.Compose

Description

Composition of functors.

Since: base-4.9.0.0

Synopsis

Documentation

newtype Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) infixr 9 Source #

Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.

Examples

Expand
>>> fmap (subtract 1) (Compose (Just [1, 2, 3]))
Compose (Just [0,1,2])
>>> Compose (Just [1, 2, 3]) <> Compose Nothing
Compose (Just [1,2,3])
>>> Compose (Just [(++ "World"), (++ "Haskell")]) <*> Compose (Just ["Hello, "])
Compose (Just ["Hello, World","Hello, Haskell"])

Constructors

Compose infixr 9 

Fields

Instances

Instances details
TestEquality f => TestEquality (Compose f g :: k2 -> Type) Source #

The deduction (via generativity) that if g x :~: g y then x :~: y.

Since: base-4.14.0.0

Instance details

Defined in Data.Functor.Compose

Methods

testEquality :: forall (a :: k2) (b :: k2). Compose f g a -> Compose f g b -> Maybe (a :~: b) Source #

Functor f => Generic1 (Compose f g :: k -> Type) Source # 
Instance details

Defined in Data.Functor.Compose

Associated Types

type Rep1 (Compose f g :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

type Rep1 (Compose f g :: k -> Type) = D1 ('MetaData "Compose" "Data.Functor.Compose" "base-4.21.0.0-631a" 'True) (C1 ('MetaCons "Compose" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCompose") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (f :.: Rec1 g)))

Methods

from1 :: forall (a :: k). Compose f g a -> Rep1 (Compose f g) a Source #

to1 :: forall (a :: k). Rep1 (Compose f g) a -> Compose f g a Source #

(Foldable1 f, Foldable1 g) => Foldable1 (Compose f g) Source #

Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

fold1 :: Semigroup m => Compose f g m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Compose f g a -> m Source #

foldMap1' :: Semigroup m => (a -> m) -> Compose f g a -> m Source #

toNonEmpty :: Compose f g a -> NonEmpty a Source #

maximum :: Ord a => Compose f g a -> a Source #

minimum :: Ord a => Compose f g a -> a Source #

head :: Compose f g a -> a Source #

last :: Compose f g a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Compose f g a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Compose f g a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Compose f g a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Compose f g a -> b Source #

(Eq1 f, Eq1 g) => Eq1 (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftEq :: (a -> b -> Bool) -> Compose f g a -> Compose f g b -> Bool Source #

(Ord1 f, Ord1 g) => Ord1 (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftCompare :: (a -> b -> Ordering) -> Compose f g a -> Compose f g b -> Ordering Source #

(Read1 f, Read1 g) => Read1 (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Compose f g a) Source #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Compose f g a] Source #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Compose f g a) Source #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Compose f g a] Source #

(Show1 f, Show1 g) => Show1 (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Compose f g a -> ShowS Source #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Compose f g a] -> ShowS Source #

(Functor f, Contravariant g) => Contravariant (Compose f g) Source # 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Compose f g a -> Compose f g a' Source #

(>$) :: b -> Compose f g b -> Compose f g a Source #

(Alternative f, Applicative g) => Alternative (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

empty :: Compose f g a Source #

(<|>) :: Compose f g a -> Compose f g a -> Compose f g a Source #

some :: Compose f g a -> Compose f g [a] Source #

many :: Compose f g a -> Compose f g [a] Source #

(Applicative f, Applicative g) => Applicative (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

pure :: a -> Compose f g a Source #

(<*>) :: Compose f g (a -> b) -> Compose f g a -> Compose f g b Source #

liftA2 :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c Source #

(*>) :: Compose f g a -> Compose f g b -> Compose f g b Source #

(<*) :: Compose f g a -> Compose f g b -> Compose f g a Source #

(Functor f, Functor g) => Functor (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

fmap :: (a -> b) -> Compose f g a -> Compose f g b Source #

(<$) :: a -> Compose f g b -> Compose f g a Source #

(Foldable f, Foldable g) => Foldable (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

fold :: Monoid m => Compose f g m -> m Source #

foldMap :: Monoid m => (a -> m) -> Compose f g a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Compose f g a -> m Source #

foldr :: (a -> b -> b) -> b -> Compose f g a -> b Source #

foldr' :: (a -> b -> b) -> b -> Compose f g a -> b Source #

foldl :: (b -> a -> b) -> b -> Compose f g a -> b Source #

foldl' :: (b -> a -> b) -> b -> Compose f g a -> b Source #

foldr1 :: (a -> a -> a) -> Compose f g a -> a Source #

foldl1 :: (a -> a -> a) -> Compose f g a -> a Source #

toList :: Compose f g a -> [a] Source #

null :: Compose f g a -> Bool Source #

length :: Compose f g a -> Int Source #

elem :: Eq a => a -> Compose f g a -> Bool Source #

maximum :: Ord a => Compose f g a -> a Source #

minimum :: Ord a => Compose f g a -> a Source #

sum :: Num a => Compose f g a -> a Source #

product :: Num a => Compose f g a -> a Source #

(Traversable f, Traversable g) => Traversable (Compose f g) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Compose f g a -> f0 (Compose f g b) Source #

sequenceA :: Applicative f0 => Compose f g (f0 a) -> f0 (Compose f g a) Source #

mapM :: Monad m => (a -> m b) -> Compose f g a -> m (Compose f g b) Source #

sequence :: Monad m => Compose f g (m a) -> m (Compose f g a) Source #

Monoid (f (g a)) => Monoid (Compose f g a) Source #

Since: base-4.16.0.0

Instance details

Defined in Data.Functor.Compose

Methods

mempty :: Compose f g a Source #

mappend :: Compose f g a -> Compose f g a -> Compose f g a Source #

mconcat :: [Compose f g a] -> Compose f g a Source #

Semigroup (f (g a)) => Semigroup (Compose f g a) Source #

Since: base-4.16.0.0

Instance details

Defined in Data.Functor.Compose

Methods

(<>) :: Compose f g a -> Compose f g a -> Compose f g a Source #

sconcat :: NonEmpty (Compose f g a) -> Compose f g a Source #

stimes :: Integral b => b -> Compose f g a -> Compose f g a Source #

(Typeable a, Typeable f, Typeable g, Typeable k1, Typeable k2, Data (f (g a))) => Data (Compose f g a) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Compose f g a -> c (Compose f g a) Source #

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

toConstr :: Compose f g a -> Constr Source #

dataTypeOf :: Compose f g a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Compose f g a)) Source #

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

gmapT :: (forall b. Data b => b -> b) -> Compose f g a -> Compose f g a Source #

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

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

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

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

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

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

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

Bounded (f (g a)) => Bounded (Compose f g a) Source #

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

minBound :: Compose f g a Source #

maxBound :: Compose f g a Source #

Enum (f (g a)) => Enum (Compose f g a) Source #

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

succ :: Compose f g a -> Compose f g a Source #

pred :: Compose f g a -> Compose f g a Source #

toEnum :: Int -> Compose f g a Source #

fromEnum :: Compose f g a -> Int Source #

enumFrom :: Compose f g a -> [Compose f g a] Source #

enumFromThen :: Compose f g a -> Compose f g a -> [Compose f g a] Source #

enumFromTo :: Compose f g a -> Compose f g a -> [Compose f g a] Source #

enumFromThenTo :: Compose f g a -> Compose f g a -> Compose f g a -> [Compose f g a] Source #

Floating (f (g a)) => Floating (Compose f g a) Source #

Since: base-4.20.0.0

Instance details

Defined in Data.Functor.Compose

Methods

pi :: Compose f g a Source #

exp :: Compose f g a -> Compose f g a Source #

log :: Compose f g a -> Compose f g a Source #

sqrt :: Compose f g a -> Compose f g a Source #

(**) :: Compose f g a -> Compose f g a -> Compose f g a Source #

logBase :: Compose f g a -> Compose f g a -> Compose f g a Source #

sin :: Compose f g a -> Compose f g a Source #

cos :: Compose f g a -> Compose f g a Source #

tan :: Compose f g a -> Compose f g a Source #

asin :: Compose f g a -> Compose f g a Source #

acos :: Compose f g a -> Compose f g a Source #

atan :: Compose f g a -> Compose f g a Source #

sinh :: Compose f g a -> Compose f g a Source #

cosh :: Compose f g a -> Compose f g a Source #

tanh :: Compose f g a -> Compose f g a Source #

asinh :: Compose f g a -> Compose f g a Source #

acosh :: Compose f g a -> Compose f g a Source #

atanh :: Compose f g a -> Compose f g a Source #

log1p :: Compose f g a -> Compose f g a Source #

expm1 :: Compose f g a -> Compose f g a Source #

log1pexp :: Compose f g a -> Compose f g a Source #

log1mexp :: Compose f g a -> Compose f g a Source #

RealFloat (f (g a)) => RealFloat (Compose f g a) Source #

Since: base-4.20.0.0

Instance details

Defined in Data.Functor.Compose

Generic (Compose f g a) Source # 
Instance details

Defined in Data.Functor.Compose

Associated Types

type Rep (Compose f g a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

type Rep (Compose f g a) = D1 ('MetaData "Compose" "Data.Functor.Compose" "base-4.21.0.0-631a" 'True) (C1 ('MetaCons "Compose" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCompose") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f (g a)))))

Methods

from :: Compose f g a -> Rep (Compose f g a) x Source #

to :: Rep (Compose f g a) x -> Compose f g a Source #

Num (f (g a)) => Num (Compose f g a) Source #

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

(+) :: Compose f g a -> Compose f g a -> Compose f g a Source #

(-) :: Compose f g a -> Compose f g a -> Compose f g a Source #

(*) :: Compose f g a -> Compose f g a -> Compose f g a Source #

negate :: Compose f g a -> Compose f g a Source #

abs :: Compose f g a -> Compose f g a Source #

signum :: Compose f g a -> Compose f g a Source #

fromInteger :: Integer -> Compose f g a Source #

Read (f (g a)) => Read (Compose f g a) Source #

Since: base-4.18.0.0

Instance details

Defined in Data.Functor.Compose

Fractional (f (g a)) => Fractional (Compose f g a) Source #

Since: base-4.20.0.0

Instance details

Defined in Data.Functor.Compose

Methods

(/) :: Compose f g a -> Compose f g a -> Compose f g a Source #

recip :: Compose f g a -> Compose f g a Source #

fromRational :: Rational -> Compose f g a Source #

Integral (f (g a)) => Integral (Compose f g a) Source #

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

quot :: Compose f g a -> Compose f g a -> Compose f g a Source #

rem :: Compose f g a -> Compose f g a -> Compose f g a Source #

div :: Compose f g a -> Compose f g a -> Compose f g a Source #

mod :: Compose f g a -> Compose f g a -> Compose f g a Source #

quotRem :: Compose f g a -> Compose f g a -> (Compose f g a, Compose f g a) Source #

divMod :: Compose f g a -> Compose f g a -> (Compose f g a, Compose f g a) Source #

toInteger :: Compose f g a -> Integer Source #

Real (f (g a)) => Real (Compose f g a) Source #

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

toRational :: Compose f g a -> Rational Source #

RealFrac (f (g a)) => RealFrac (Compose f g a) Source #

Since: base-4.20.0.0

Instance details

Defined in Data.Functor.Compose

Methods

properFraction :: Integral b => Compose f g a -> (b, Compose f g a) Source #

truncate :: Integral b => Compose f g a -> b Source #

round :: Integral b => Compose f g a -> b Source #

ceiling :: Integral b => Compose f g a -> b Source #

floor :: Integral b => Compose f g a -> b Source #

Show (f (g a)) => Show (Compose f g a) Source #

Since: base-4.18.0.0

Instance details

Defined in Data.Functor.Compose

Methods

showsPrec :: Int -> Compose f g a -> ShowS Source #

show :: Compose f g a -> String Source #

showList :: [Compose f g a] -> ShowS Source #

Eq (f (g a)) => Eq (Compose f g a) Source #

Since: base-4.18.0.0

Instance details

Defined in Data.Functor.Compose

Methods

(==) :: Compose f g a -> Compose f g a -> Bool Source #

(/=) :: Compose f g a -> Compose f g a -> Bool Source #

Ord (f (g a)) => Ord (Compose f g a) Source #

Since: base-4.18.0.0

Instance details

Defined in Data.Functor.Compose

Methods

compare :: Compose f g a -> Compose f g a -> Ordering Source #

(<) :: Compose f g a -> Compose f g a -> Bool Source #

(<=) :: Compose f g a -> Compose f g a -> Bool Source #

(>) :: Compose f g a -> Compose f g a -> Bool Source #

(>=) :: Compose f g a -> Compose f g a -> Bool Source #

max :: Compose f g a -> Compose f g a -> Compose f g a Source #

min :: Compose f g a -> Compose f g a -> Compose f g a Source #

type Rep1 (Compose f g :: k -> Type) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

type Rep1 (Compose f g :: k -> Type) = D1 ('MetaData "Compose" "Data.Functor.Compose" "base-4.21.0.0-631a" 'True) (C1 ('MetaCons "Compose" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCompose") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (f :.: Rec1 g)))
type Rep (Compose f g a) Source #

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

type Rep (Compose f g a) = D1 ('MetaData "Compose" "Data.Functor.Compose" "base-4.21.0.0-631a" 'True) (C1 ('MetaCons "Compose" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCompose") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f (g a)))))