base-4.13.0.0: Basic libraries

Control.Applicative

Description

This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>=, but

• it has more instances.
• it is sufficient for many uses, e.g. context-free parsing, or the Traversable class.
• instances can perform analysis of computations before they are executed, and thus produce shared optimizations.

This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra.

For more details, see Applicative Programming with Effects, by Conor McBride and Ross Paterson.

Synopsis

# Applicative functors

class Functor f => Applicative f where #

A functor with application, providing operations to

• embed pure expressions (pure), and
• sequence computations and combine their results (<*> and liftA2).

A minimal complete definition must include implementations of pure and of either <*> or liftA2. If it defines both, then they must behave the same as their default definitions:

(<*>) = liftA2 id
liftA2 f x y = f <$> x <*> y Further, any definition must satisfy the following: Identity pure id <*> v = v Composition pure (.) <*> u <*> v <*> w = u <*> (v <*> w) Homomorphism pure f <*> pure x = pure (f x) Interchange u <*> pure y = pure ($ y) <*> u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

• u *> v = (id <$ u) <*> v • u <* v = liftA2 const u v As a consequence of these laws, the Functor instance for f will satisfy • fmap f x = pure f <*> x It may be useful to note that supposing forall x y. p (q x y) = f x . g y it follows from the above that liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v If f is also a Monad, it should satisfy • pure = return • (<*>) = ap • (*>) = (>>) (which implies that pure and <*> satisfy the applicative functor laws). Minimal complete definition pure, ((<*>) | liftA2) Methods pure :: a -> f a # Lift a value. (<*>) :: f (a -> b) -> f a -> f b infixl 4 # Sequential application. A few functors support an implementation of <*> that is more efficient than the default one. liftA2 :: (a -> b -> c) -> f a -> f b -> f c # Lift a binary function to actions. Some functors support an implementation of liftA2 that is more efficient than the default one. In particular, if fmap is an expensive operation, it is likely better to use liftA2 than to fmap over the structure and then use <*>. (*>) :: f a -> f b -> f b infixl 4 # Sequence actions, discarding the value of the first argument. (<*) :: f a -> f b -> f a infixl 4 # Sequence actions, discarding the value of the second argument. #### Instances Instances details  # Since: base-2.1 Instance detailsDefined in GHC.Base Methodspure :: a -> [a] #(<*>) :: [a -> b] -> [a] -> [b] #liftA2 :: (a -> b -> c) -> [a] -> [b] -> [c] #(*>) :: [a] -> [b] -> [b] #(<*) :: [a] -> [b] -> [a] # # Since: base-2.1 Instance detailsDefined in GHC.Base Methodspure :: a -> Maybe a #(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b #liftA2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #(*>) :: Maybe a -> Maybe b -> Maybe b #(<*) :: Maybe a -> Maybe b -> Maybe a # # Since: base-2.1 Instance detailsDefined in GHC.Base Methodspure :: a -> IO a #(<*>) :: IO (a -> b) -> IO a -> IO b #liftA2 :: (a -> b -> c) -> IO a -> IO b -> IO c #(*>) :: IO a -> IO b -> IO b #(<*) :: IO a -> IO b -> IO a # # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> Par1 a #(<*>) :: Par1 (a -> b) -> Par1 a -> Par1 b #liftA2 :: (a -> b -> c) -> Par1 a -> Par1 b -> Par1 c #(*>) :: Par1 a -> Par1 b -> Par1 b #(<*) :: Par1 a -> Par1 b -> Par1 a # # Since: base-4.9.0.0 Instance detailsDefined in GHC.Base Methodspure :: a -> NonEmpty a #(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b #liftA2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c #(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a # # Since: base-4.8.0.0 Instance detailsDefined in GHC.GHCi Methodspure :: a -> NoIO a #(<*>) :: NoIO (a -> b) -> NoIO a -> NoIO b #liftA2 :: (a -> b -> c) -> NoIO a -> NoIO b -> NoIO c #(*>) :: NoIO a -> NoIO b -> NoIO b #(<*) :: NoIO a -> NoIO b -> NoIO a # # Since: base-4.6.0.0 Instance detailsDefined in Text.ParserCombinators.ReadP Methodspure :: a -> ReadP a #(<*>) :: ReadP (a -> b) -> ReadP a -> ReadP b #liftA2 :: (a -> b -> c) -> ReadP a -> ReadP b -> ReadP c #(*>) :: ReadP a -> ReadP b -> ReadP b #(<*) :: ReadP a -> ReadP b -> ReadP a # # Since: base-4.6.0.0 Instance detailsDefined in Text.ParserCombinators.ReadPrec Methodspure :: a -> ReadPrec a #(<*>) :: ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b #liftA2 :: (a -> b -> c) -> ReadPrec a -> ReadPrec b -> ReadPrec c #(*>) :: ReadPrec a -> ReadPrec b -> ReadPrec b #(<*) :: ReadPrec a -> ReadPrec b -> ReadPrec a # # Since: base-4.11.0.0 Instance detailsDefined in Data.Ord Methodspure :: a -> Down a #(<*>) :: Down (a -> b) -> Down a -> Down b #liftA2 :: (a -> b -> c) -> Down a -> Down b -> Down c #(*>) :: Down a -> Down b -> Down b #(<*) :: Down a -> Down b -> Down a # # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodspure :: a -> Product a #(<*>) :: Product (a -> b) -> Product a -> Product b #liftA2 :: (a -> b -> c) -> Product a -> Product b -> Product c #(*>) :: Product a -> Product b -> Product b #(<*) :: Product a -> Product b -> Product a # # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodspure :: a -> Sum a #(<*>) :: Sum (a -> b) -> Sum a -> Sum b #liftA2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #(*>) :: Sum a -> Sum b -> Sum b #(<*) :: Sum a -> Sum b -> Sum a # # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodspure :: a -> Dual a #(<*>) :: Dual (a -> b) -> Dual a -> Dual b #liftA2 :: (a -> b -> c) -> Dual a -> Dual b -> Dual c #(*>) :: Dual a -> Dual b -> Dual b #(<*) :: Dual a -> Dual b -> Dual a # # Since: base-4.8.0.0 Instance detailsDefined in Data.Monoid Methodspure :: a -> Last a #(<*>) :: Last (a -> b) -> Last a -> Last b #liftA2 :: (a -> b -> c) -> Last a -> Last b -> Last c #(*>) :: Last a -> Last b -> Last b #(<*) :: Last a -> Last b -> Last a # # Since: base-4.8.0.0 Instance detailsDefined in Data.Monoid Methodspure :: a -> First a #(<*>) :: First (a -> b) -> First a -> First b #liftA2 :: (a -> b -> c) -> First a -> First b -> First c #(*>) :: First a -> First b -> First b #(<*) :: First a -> First b -> First a # # Since: base-4.8.0.0 Instance detailsDefined in GHC.Conc.Sync Methodspure :: a -> STM a #(<*>) :: STM (a -> b) -> STM a -> STM b #liftA2 :: (a -> b -> c) -> STM a -> STM b -> STM c #(*>) :: STM a -> STM b -> STM b #(<*) :: STM a -> STM b -> STM a # # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodspure :: a -> Identity a #(<*>) :: Identity (a -> b) -> Identity a -> Identity b #liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #(*>) :: Identity a -> Identity b -> Identity b #(<*) :: Identity a -> Identity b -> Identity a # # f <$> ZipList xs1 <*> ... <*> ZipList xsN = ZipList (zipWithN f xs1 ... xsN)where zipWithN refers to the zipWith function of the appropriate arity (zipWith, zipWith3, zipWith4, ...). For example:(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}Since: base-2.1 Instance detailsDefined in Control.Applicative Methodspure :: a -> ZipList a #(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b #liftA2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #(*>) :: ZipList a -> ZipList b -> ZipList b #(<*) :: ZipList a -> ZipList b -> ZipList a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodspure :: a -> Option a #(<*>) :: Option (a -> b) -> Option a -> Option b #liftA2 :: (a -> b -> c) -> Option a -> Option b -> Option c #(*>) :: Option a -> Option b -> Option b #(<*) :: Option a -> Option b -> Option a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodspure :: a -> Last a #(<*>) :: Last (a -> b) -> Last a -> Last b #liftA2 :: (a -> b -> c) -> Last a -> Last b -> Last c #(*>) :: Last a -> Last b -> Last b #(<*) :: Last a -> Last b -> Last a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodspure :: a -> First a #(<*>) :: First (a -> b) -> First a -> First b #liftA2 :: (a -> b -> c) -> First a -> First b -> First c #(*>) :: First a -> First b -> First b #(<*) :: First a -> First b -> First a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodspure :: a -> Max a #(<*>) :: Max (a -> b) -> Max a -> Max b #liftA2 :: (a -> b -> c) -> Max a -> Max b -> Max c #(*>) :: Max a -> Max b -> Max b #(<*) :: Max a -> Max b -> Max a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodspure :: a -> Min a #(<*>) :: Min (a -> b) -> Min a -> Min b #liftA2 :: (a -> b -> c) -> Min a -> Min b -> Min c #(*>) :: Min a -> Min b -> Min b #(<*) :: Min a -> Min b -> Min a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Complex Methodspure :: a -> Complex a #(<*>) :: Complex (a -> b) -> Complex a -> Complex b #liftA2 :: (a -> b -> c) -> Complex a -> Complex b -> Complex c #(*>) :: Complex a -> Complex b -> Complex b #(<*) :: Complex a -> Complex b -> Complex a # # Since: base-3.0 Instance detailsDefined in Data.Either Methodspure :: a -> Either e a #(<*>) :: Either e (a -> b) -> Either e a -> Either e b #liftA2 :: (a -> b -> c) -> Either e a -> Either e b -> Either e c #(*>) :: Either e a -> Either e b -> Either e b #(<*) :: Either e a -> Either e b -> Either e a # Applicative (U1 :: Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> U1 a #(<*>) :: U1 (a -> b) -> U1 a -> U1 b #liftA2 :: (a -> b -> c) -> U1 a -> U1 b -> U1 c #(*>) :: U1 a -> U1 b -> U1 b #(<*) :: U1 a -> U1 b -> U1 a # Monoid a => Applicative ((,) a) # For tuples, the Monoid constraint on a determines how the first values merge. For example, Strings concatenate:("hello ", (+15)) <*> ("world!", 2002) ("hello world!",2017)Since: base-2.1 Instance detailsDefined in GHC.Base Methodspure :: a0 -> (a, a0) #(<*>) :: (a, a0 -> b) -> (a, a0) -> (a, b) #liftA2 :: (a0 -> b -> c) -> (a, a0) -> (a, b) -> (a, c) #(*>) :: (a, a0) -> (a, b) -> (a, b) #(<*) :: (a, a0) -> (a, b) -> (a, a0) # # Since: base-4.4.0.0 Instance detailsDefined in GHC.ST Methodspure :: a -> ST s a #(<*>) :: ST s (a -> b) -> ST s a -> ST s b #liftA2 :: (a -> b -> c) -> ST s a -> ST s b -> ST s c #(*>) :: ST s a -> ST s b -> ST s b #(<*) :: ST s a -> ST s b -> ST s a # Applicative (Proxy :: Type -> Type) # Since: base-4.7.0.0 Instance detailsDefined in Data.Proxy Methodspure :: a -> Proxy a #(<*>) :: Proxy (a -> b) -> Proxy a -> Proxy b #liftA2 :: (a -> b -> c) -> Proxy a -> Proxy b -> Proxy c #(*>) :: Proxy a -> Proxy b -> Proxy b #(<*) :: Proxy a -> Proxy b -> Proxy a # Arrow a => Applicative (ArrowMonad a) # Since: base-4.6.0.0 Instance detailsDefined in Control.Arrow Methodspure :: a0 -> ArrowMonad a a0 #(<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b #liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c #(*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b #(<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 # Monad m => Applicative (WrappedMonad m) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodspure :: a -> WrappedMonad m a #(<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b #liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c #(*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #(<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # # Since: base-2.1 Instance detailsDefined in Control.Monad.ST.Lazy.Imp Methodspure :: a -> ST s a #(<*>) :: ST s (a -> b) -> ST s a -> ST s b #liftA2 :: (a -> b -> c) -> ST s a -> ST s b -> ST s c #(*>) :: ST s a -> ST s b -> ST s b #(<*) :: ST s a -> ST s b -> ST s a # Applicative f => Applicative (Rec1 f) # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> Rec1 f a #(<*>) :: Rec1 f (a -> b) -> Rec1 f a -> Rec1 f b #liftA2 :: (a -> b -> c) -> Rec1 f a -> Rec1 f b -> Rec1 f c #(*>) :: Rec1 f a -> Rec1 f b -> Rec1 f b #(<*) :: Rec1 f a -> Rec1 f b -> Rec1 f a # Applicative f => Applicative (Alt f) # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodspure :: a -> Alt f a #(<*>) :: Alt f (a -> b) -> Alt f a -> Alt f b #liftA2 :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c #(*>) :: Alt f a -> Alt f b -> Alt f b #(<*) :: Alt f a -> Alt f b -> Alt f a # Applicative f => Applicative (Ap f) # Since: base-4.12.0.0 Instance detailsDefined in Data.Monoid Methodspure :: a -> Ap f a #(<*>) :: Ap f (a -> b) -> Ap f a -> Ap f b #liftA2 :: (a -> b -> c) -> Ap f a -> Ap f b -> Ap f c #(*>) :: Ap f a -> Ap f b -> Ap f b #(<*) :: Ap f a -> Ap f b -> Ap f a # Monoid m => Applicative (Const m :: Type -> Type) # Since: base-2.0.1 Instance detailsDefined in Data.Functor.Const Methodspure :: a -> Const m a #(<*>) :: Const m (a -> b) -> Const m a -> Const m b #liftA2 :: (a -> b -> c) -> Const m a -> Const m b -> Const m c #(*>) :: Const m a -> Const m b -> Const m b #(<*) :: Const m a -> Const m b -> Const m a # Arrow a => Applicative (WrappedArrow a b) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodspure :: a0 -> WrappedArrow a b a0 #(<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c #(*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 #(<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # Applicative ((->) a :: Type -> Type) # Since: base-2.1 Instance detailsDefined in GHC.Base Methodspure :: a0 -> a -> a0 #(<*>) :: (a -> (a0 -> b)) -> (a -> a0) -> a -> b #liftA2 :: (a0 -> b -> c) -> (a -> a0) -> (a -> b) -> a -> c #(*>) :: (a -> a0) -> (a -> b) -> a -> b #(<*) :: (a -> a0) -> (a -> b) -> a -> a0 # Monoid c => Applicative (K1 i c :: Type -> Type) # Since: base-4.12.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> K1 i c a #(<*>) :: K1 i c (a -> b) -> K1 i c a -> K1 i c b #liftA2 :: (a -> b -> c0) -> K1 i c a -> K1 i c b -> K1 i c c0 #(*>) :: K1 i c a -> K1 i c b -> K1 i c b #(<*) :: K1 i c a -> K1 i c b -> K1 i c a # (Applicative f, Applicative g) => Applicative (f :*: g) # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> (f :*: g) a #(<*>) :: (f :*: g) (a -> b) -> (f :*: g) a -> (f :*: g) b #liftA2 :: (a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c #(*>) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) b #(<*) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) a # (Applicative f, Applicative g) => Applicative (Product f g) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Product Methodspure :: a -> Product f g a #(<*>) :: Product f g (a -> b) -> Product f g a -> Product f g b #liftA2 :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c #(*>) :: Product f g a -> Product f g b -> Product f g b #(<*) :: Product f g a -> Product f g b -> Product f g a # Applicative f => Applicative (M1 i c f) # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> M1 i c f a #(<*>) :: M1 i c f (a -> b) -> M1 i c f a -> M1 i c f b #liftA2 :: (a -> b -> c0) -> M1 i c f a -> M1 i c f b -> M1 i c f c0 #(*>) :: M1 i c f a -> M1 i c f b -> M1 i c f b #(<*) :: M1 i c f a -> M1 i c f b -> M1 i c f a # (Applicative f, Applicative g) => Applicative (f :.: g) # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodspure :: a -> (f :.: g) a #(<*>) :: (f :.: g) (a -> b) -> (f :.: g) a -> (f :.: g) b #liftA2 :: (a -> b -> c) -> (f :.: g) a -> (f :.: g) b -> (f :.: g) c #(*>) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) b #(<*) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) a # (Applicative f, Applicative g) => Applicative (Compose f g) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Compose Methodspure :: a -> Compose f g a #(<*>) :: Compose f g (a -> b) -> Compose f g a -> Compose f g b #liftA2 :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c #(*>) :: Compose f g a -> Compose f g b -> Compose f g b #(<*) :: Compose f g a -> Compose f g b -> Compose f g a # # Alternatives class Applicative f => Alternative f where # A monoid on applicative functors. If defined, some and many should be the least solutions of the equations: • some v = (:) <$> v <*> many v
• many v = some v <|> pure []

Minimal complete definition

Methods

empty :: f a #

The identity of <|>

(<|>) :: f a -> f a -> f a infixl 3 #

An associative binary operation

some :: f a -> f [a] #

One or more.

many :: f a -> f [a] #

Zero or more.

#### Instances

Instances details

# Instances

newtype Const a b #

The Const functor.

Constructors

 Const FieldsgetConst :: a

#### Instances

Instances details
 Generic1 (Const a :: k -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Associated Typestype Rep1 (Const a) :: k -> Type # Methodsfrom1 :: forall (a0 :: k0). Const a a0 -> Rep1 (Const a) a0 #to1 :: forall (a0 :: k0). Rep1 (Const a) a0 -> Const a a0 # Show2 (Const :: Type -> Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Const a b -> ShowS #liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Const a b] -> ShowS # Read2 (Const :: Type -> Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Const a b) #liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b] #liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Const a b) #liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Const a b] # Ord2 (Const :: Type -> Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Const a c -> Const b d -> Ordering # Eq2 (Const :: Type -> Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Const a c -> Const b d -> Bool # Bifunctor (Const :: Type -> Type -> Type) # Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> Const a c -> Const b d #first :: (a -> b) -> Const a c -> Const b c #second :: (b -> c) -> Const a b -> Const a c # Bifoldable (Const :: Type -> Type -> Type) # Since: base-4.10.0.0 Instance detailsDefined in Data.Bifoldable Methodsbifold :: Monoid m => Const m m -> m #bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Const a b -> m #bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Const a b -> c #bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Const a b -> c # Bitraversable (Const :: Type -> Type -> Type) # Since: base-4.10.0.0 Instance detailsDefined in Data.Bitraversable Methodsbitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Const a b -> f (Const c d) # Functor (Const m :: Type -> Type) # Since: base-2.1 Instance detailsDefined in Data.Functor.Const Methodsfmap :: (a -> b) -> Const m a -> Const m b #(<$) :: a -> Const m b -> Const m a # Monoid m => Applicative (Const m :: Type -> Type) # Since: base-2.0.1 Instance detailsDefined in Data.Functor.Const Methodspure :: a -> Const m a #(<*>) :: Const m (a -> b) -> Const m a -> Const m b #liftA2 :: (a -> b -> c) -> Const m a -> Const m b -> Const m c #(*>) :: Const m a -> Const m b -> Const m b #(<*) :: Const m a -> Const m b -> Const m a # Foldable (Const m :: Type -> Type) # Since: base-4.7.0.0 Instance detailsDefined in Data.Functor.Const Methodsfold :: Monoid m0 => Const m m0 -> m0 #foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 #foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 #foldr :: (a -> b -> b) -> b -> Const m a -> b #foldr' :: (a -> b -> b) -> b -> Const m a -> b #foldl :: (b -> a -> b) -> b -> Const m a -> b #foldl' :: (b -> a -> b) -> b -> Const m a -> b #foldr1 :: (a -> a -> a) -> Const m a -> a #foldl1 :: (a -> a -> a) -> Const m a -> a #toList :: Const m a -> [a] #null :: Const m a -> Bool #length :: Const m a -> Int #elem :: Eq a => a -> Const m a -> Bool #maximum :: Ord a => Const m a -> a #minimum :: Ord a => Const m a -> a #sum :: Num a => Const m a -> a #product :: Num a => Const m a -> a # Traversable (Const m :: Type -> Type) # Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Const m a -> f (Const m b) #sequenceA :: Applicative f => Const m (f a) -> f (Const m a) #mapM :: Monad m0 => (a -> m0 b) -> Const m a -> m0 (Const m b) #sequence :: Monad m0 => Const m (m0 a) -> m0 (Const m a) # Show a => Show1 (Const a :: Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Const a a0 -> ShowS #liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Const a a0] -> ShowS # Read a => Read1 (Const a :: Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Const a a0) #liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Const a a0] #liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Const a a0) #liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Const a a0] # Ord a => Ord1 (Const a :: Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftCompare :: (a0 -> b -> Ordering) -> Const a a0 -> Const a b -> Ordering # Eq a => Eq1 (Const a :: Type -> Type) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftEq :: (a0 -> b -> Bool) -> Const a a0 -> Const a b -> Bool # Contravariant (Const a :: Type -> Type) # Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a0 -> b) -> Const a b -> Const a a0 #(>$) :: b -> Const a b -> Const a a0 # Bounded a => Bounded (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodsminBound :: Const a b #maxBound :: Const a b # Enum a => Enum (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methodssucc :: Const a b -> Const a b #pred :: Const a b -> Const a b #toEnum :: Int -> Const a b #fromEnum :: Const a b -> Int #enumFrom :: Const a b -> [Const a b] #enumFromThen :: Const a b -> Const a b -> [Const a b] #enumFromTo :: Const a b -> Const a b -> [Const a b] #enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] # Eq a => Eq (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methods(==) :: Const a b -> Const a b -> Bool Source #(/=) :: Const a b -> Const a b -> Bool Source # Floating a => Floating (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methodspi :: Const a b #exp :: Const a b -> Const a b #log :: Const a b -> Const a b #sqrt :: Const a b -> Const a b #(**) :: Const a b -> Const a b -> Const a b #logBase :: Const a b -> Const a b -> Const a b #sin :: Const a b -> Const a b #cos :: Const a b -> Const a b #tan :: Const a b -> Const a b #asin :: Const a b -> Const a b #acos :: Const a b -> Const a b #atan :: Const a b -> Const a b #sinh :: Const a b -> Const a b #cosh :: Const a b -> Const a b #tanh :: Const a b -> Const a b #asinh :: Const a b -> Const a b #acosh :: Const a b -> Const a b #atanh :: Const a b -> Const a b #log1p :: Const a b -> Const a b #expm1 :: Const a b -> Const a b #log1pexp :: Const a b -> Const a b #log1mexp :: Const a b -> Const a b # Fractional a => Fractional (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methods(/) :: Const a b -> Const a b -> Const a b #recip :: Const a b -> Const a b #fromRational :: Rational -> Const a b # Integral a => Integral (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methodsquot :: Const a b -> Const a b -> Const a b #rem :: Const a b -> Const a b -> Const a b #div :: Const a b -> Const a b -> Const a b #mod :: Const a b -> Const a b -> Const a b #quotRem :: Const a b -> Const a b -> (Const a b, Const a b) #divMod :: Const a b -> Const a b -> (Const a b, Const a b) #toInteger :: Const a b -> Integer # (Typeable k, Data a, Typeable b) => Data (Const a b) # Since: base-4.10.0.0 Instance detailsDefined in Data.Data Methodsgfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Const a b -> c (Const a b) #gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Const a b) #toConstr :: Const a b -> Constr #dataTypeOf :: Const a b -> DataType #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Const a b)) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Const a b)) #gmapT :: (forall b0. Data b0 => b0 -> b0) -> Const a b -> Const a b #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const a b -> r #gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const a b -> r #gmapQ :: (forall d. Data d => d -> u) -> Const a b -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Const a b -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Const a b -> m (Const a b) #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Const a b -> m (Const a b) #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Const a b -> m (Const a b) # Num a => Num (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methods(+) :: Const a b -> Const a b -> Const a b #(-) :: Const a b -> Const a b -> Const a b #(*) :: Const a b -> Const a b -> Const a b #negate :: Const a b -> Const a b #abs :: Const a b -> Const a b #signum :: Const a b -> Const a b #fromInteger :: Integer -> Const a b # Ord a => Ord (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methodscompare :: Const a b -> Const a b -> Ordering Source #(<) :: Const a b -> Const a b -> Bool Source #(<=) :: Const a b -> Const a b -> Bool Source #(>) :: Const a b -> Const a b -> Bool Source #(>=) :: Const a b -> Const a b -> Bool Source #max :: Const a b -> Const a b -> Const a b Source #min :: Const a b -> Const a b -> Const a b Source # Read a => Read (Const a b) # This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removedSince: base-4.8.0.0 Instance detailsDefined in Data.Functor.Const MethodsreadsPrec :: Int -> ReadS (Const a b) #readList :: ReadS [Const a b] #readPrec :: ReadPrec (Const a b) #readListPrec :: ReadPrec [Const a b] # Real a => Real (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodstoRational :: Const a b -> Rational # RealFloat a => RealFloat (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodsfloatRadix :: Const a b -> Integer #floatDigits :: Const a b -> Int #floatRange :: Const a b -> (Int, Int) #decodeFloat :: Const a b -> (Integer, Int) #encodeFloat :: Integer -> Int -> Const a b #exponent :: Const a b -> Int #significand :: Const a b -> Const a b #scaleFloat :: Int -> Const a b -> Const a b #isNaN :: Const a b -> Bool #isInfinite :: Const a b -> Bool #isDenormalized :: Const a b -> Bool #isNegativeZero :: Const a b -> Bool #isIEEE :: Const a b -> Bool #atan2 :: Const a b -> Const a b -> Const a b # RealFrac a => RealFrac (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodsproperFraction :: Integral b0 => Const a b -> (b0, Const a b) #truncate :: Integral b0 => Const a b -> b0 #round :: Integral b0 => Const a b -> b0 #ceiling :: Integral b0 => Const a b -> b0 #floor :: Integral b0 => Const a b -> b0 # Show a => Show (Const a b) # This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removedSince: base-4.8.0.0 Instance detailsDefined in Data.Functor.Const MethodsshowsPrec :: Int -> Const a b -> ShowS #show :: Const a b -> String #showList :: [Const a b] -> ShowS # Ix a => Ix (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methodsrange :: (Const a b, Const a b) -> [Const a b] #index :: (Const a b, Const a b) -> Const a b -> Int #unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int #inRange :: (Const a b, Const a b) -> Const a b -> Bool #rangeSize :: (Const a b, Const a b) -> Int #unsafeRangeSize :: (Const a b, Const a b) -> Int # IsString a => IsString (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.String MethodsfromString :: String -> Const a b # Generic (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Associated Typestype Rep (Const a b) :: Type -> Type # Methodsfrom :: Const a b -> Rep (Const a b) x #to :: Rep (Const a b) x -> Const a b # Semigroup a => Semigroup (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methods(<>) :: Const a b -> Const a b -> Const a b #sconcat :: NonEmpty (Const a b) -> Const a b #stimes :: Integral b0 => b0 -> Const a b -> Const a b # Monoid a => Monoid (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methodsmempty :: Const a b #mappend :: Const a b -> Const a b -> Const a b #mconcat :: [Const a b] -> Const a b # FiniteBits a => FiniteBits (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodsfiniteBitSize :: Const a b -> Int #countLeadingZeros :: Const a b -> Int #countTrailingZeros :: Const a b -> Int # Bits a => Bits (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const Methods(.&.) :: Const a b -> Const a b -> Const a b #(.|.) :: Const a b -> Const a b -> Const a b #xor :: Const a b -> Const a b -> Const a b #complement :: Const a b -> Const a b #shift :: Const a b -> Int -> Const a b #rotate :: Const a b -> Int -> Const a b #zeroBits :: Const a b #bit :: Int -> Const a b #setBit :: Const a b -> Int -> Const a b #clearBit :: Const a b -> Int -> Const a b #complementBit :: Const a b -> Int -> Const a b #testBit :: Const a b -> Int -> Bool #bitSizeMaybe :: Const a b -> Maybe Int #bitSize :: Const a b -> Int #isSigned :: Const a b -> Bool #shiftL :: Const a b -> Int -> Const a b #unsafeShiftL :: Const a b -> Int -> Const a b #shiftR :: Const a b -> Int -> Const a b #unsafeShiftR :: Const a b -> Int -> Const a b #rotateL :: Const a b -> Int -> Const a b #rotateR :: Const a b -> Int -> Const a b #popCount :: Const a b -> Int # Storable a => Storable (Const a b) # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodssizeOf :: Const a b -> Int #alignment :: Const a b -> Int #peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b) #pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO () #peekByteOff :: Ptr b0 -> Int -> IO (Const a b) #pokeByteOff :: Ptr b0 -> Int -> Const a b -> IO () #peek :: Ptr (Const a b) -> IO (Const a b) #poke :: Ptr (Const a b) -> Const a b -> IO () # type Rep1 (Const a :: k -> Type) # Instance detailsDefined in Data.Functor.Const type Rep1 (Const a :: k -> Type) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) type Rep (Const a b) # Instance detailsDefined in Data.Functor.Const type Rep (Const a b) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Constructors

#### Instances

Instances details
 Monad m => Monad (WrappedMonad m) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Methods(>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b #(>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #return :: a -> WrappedMonad m a # Monad m => Functor (WrappedMonad m) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b #(<$) :: a -> WrappedMonad m b -> WrappedMonad m a # Monad m => Applicative (WrappedMonad m) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodspure :: a -> WrappedMonad m a #(<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b #liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c #(*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #(<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsempty :: WrappedMonad m a #(<|>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a #some :: WrappedMonad m a -> WrappedMonad m [a] #many :: WrappedMonad m a -> WrappedMonad m [a] # Generic1 (WrappedMonad m :: Type -> Type) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Associated Typestype Rep1 (WrappedMonad m) :: k -> Type # Methodsfrom1 :: forall (a :: k). WrappedMonad m a -> Rep1 (WrappedMonad m) a #to1 :: forall (a :: k). Rep1 (WrappedMonad m) a -> WrappedMonad m a # Generic (WrappedMonad m a) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Associated Typestype Rep (WrappedMonad m a) :: Type -> Type # Methodsfrom :: WrappedMonad m a -> Rep (WrappedMonad m a) x #to :: Rep (WrappedMonad m a) x -> WrappedMonad m a # type Rep1 (WrappedMonad m :: Type -> Type) # Instance detailsDefined in Control.Applicative type Rep1 (WrappedMonad m :: Type -> Type) = D1 ('MetaData "WrappedMonad" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapMonad" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonad") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 m))) type Rep (WrappedMonad m a) # Instance detailsDefined in Control.Applicative type Rep (WrappedMonad m a) = D1 ('MetaData "WrappedMonad" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapMonad" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonad") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m a)))) newtype WrappedArrow a b c # Constructors  WrapArrow FieldsunwrapArrow :: a b c #### Instances Instances details  Generic1 (WrappedArrow a b :: Type -> Type) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Associated Typestype Rep1 (WrappedArrow a b) :: k -> Type # Methodsfrom1 :: forall (a0 :: k). WrappedArrow a b a0 -> Rep1 (WrappedArrow a b) a0 #to1 :: forall (a0 :: k). Rep1 (WrappedArrow a b) a0 -> WrappedArrow a b a0 # Arrow a => Functor (WrappedArrow a b) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #(<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # Arrow a => Applicative (WrappedArrow a b) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodspure :: a0 -> WrappedArrow a b a0 #(<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c #(*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 #(<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsempty :: WrappedArrow a b a0 #(<|>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 #some :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #many :: WrappedArrow a b a0 -> WrappedArrow a b [a0] # Generic (WrappedArrow a b c) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Associated Typestype Rep (WrappedArrow a b c) :: Type -> Type # Methodsfrom :: WrappedArrow a b c -> Rep (WrappedArrow a b c) x #to :: Rep (WrappedArrow a b c) x -> WrappedArrow a b c # type Rep1 (WrappedArrow a b :: Type -> Type) # Instance detailsDefined in Control.Applicative type Rep1 (WrappedArrow a b :: Type -> Type) = D1 ('MetaData "WrappedArrow" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapArrow" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 (a b)))) type Rep (WrappedArrow a b c) # Instance detailsDefined in Control.Applicative type Rep (WrappedArrow a b c) = D1 ('MetaData "WrappedArrow" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapArrow" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a b c))))

newtype ZipList a #

Lists, but with an Applicative functor based on zipping.

Constructors

 ZipList FieldsgetZipList :: [a]

#### Instances

Instances details
 # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a -> b) -> ZipList a -> ZipList b #(<$) :: a -> ZipList b -> ZipList a # # f <$> ZipList xs1 <*> ... <*> ZipList xsN = ZipList (zipWithN f xs1 ... xsN)where zipWithN refers to the zipWith function of the appropriate arity (zipWith, zipWith3, zipWith4, ...). For example:(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}Since: base-2.1 Instance detailsDefined in Control.Applicative Methodspure :: a -> ZipList a #(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b #liftA2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #(*>) :: ZipList a -> ZipList b -> ZipList b #(<*) :: ZipList a -> ZipList b -> ZipList a # # Since: base-4.9.0.0 Instance detailsDefined in Control.Applicative Methodsfold :: Monoid m => ZipList m -> m #foldMap :: Monoid m => (a -> m) -> ZipList a -> m #foldMap' :: Monoid m => (a -> m) -> ZipList a -> m #foldr :: (a -> b -> b) -> b -> ZipList a -> b #foldr' :: (a -> b -> b) -> b -> ZipList a -> b #foldl :: (b -> a -> b) -> b -> ZipList a -> b #foldl' :: (b -> a -> b) -> b -> ZipList a -> b #foldr1 :: (a -> a -> a) -> ZipList a -> a #foldl1 :: (a -> a -> a) -> ZipList a -> a #toList :: ZipList a -> [a] #null :: ZipList a -> Bool #length :: ZipList a -> Int #elem :: Eq a => a -> ZipList a -> Bool #maximum :: Ord a => ZipList a -> a #minimum :: Ord a => ZipList a -> a #sum :: Num a => ZipList a -> a #product :: Num a => ZipList a -> a # # Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> ZipList a -> f (ZipList b) #sequenceA :: Applicative f => ZipList (f a) -> f (ZipList a) #mapM :: Monad m => (a -> m b) -> ZipList a -> m (ZipList b) #sequence :: Monad m => ZipList (m a) -> m (ZipList a) # # Since: base-4.11.0.0 Instance detailsDefined in Control.Applicative Methods(<|>) :: ZipList a -> ZipList a -> ZipList a #some :: ZipList a -> ZipList [a] #many :: ZipList a -> ZipList [a] # Eq a => Eq (ZipList a) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Methods(==) :: ZipList a -> ZipList a -> Bool Source #(/=) :: ZipList a -> ZipList a -> Bool Source # Ord a => Ord (ZipList a) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Methodscompare :: ZipList a -> ZipList a -> Ordering Source #(<) :: ZipList a -> ZipList a -> Bool Source #(<=) :: ZipList a -> ZipList a -> Bool Source #(>) :: ZipList a -> ZipList a -> Bool Source #(>=) :: ZipList a -> ZipList a -> Bool Source #max :: ZipList a -> ZipList a -> ZipList a Source #min :: ZipList a -> ZipList a -> ZipList a Source # Read a => Read (ZipList a) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative MethodsreadsPrec :: Int -> ReadS (ZipList a) # Show a => Show (ZipList a) # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative MethodsshowsPrec :: Int -> ZipList a -> ShowS #show :: ZipList a -> String #showList :: [ZipList a] -> ShowS # # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Associated Typestype Rep (ZipList a) :: Type -> Type # Methodsfrom :: ZipList a -> Rep (ZipList a) x #to :: Rep (ZipList a) x -> ZipList a # # Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Associated Typestype Rep1 ZipList :: k -> Type # Methodsfrom1 :: forall (a :: k). ZipList a -> Rep1 ZipList a #to1 :: forall (a :: k). Rep1 ZipList a -> ZipList a # type Rep (ZipList a) # Instance detailsDefined in Control.Applicative type Rep (ZipList a) = D1 ('MetaData "ZipList" "Control.Applicative" "base" 'True) (C1 ('MetaCons "ZipList" 'PrefixI 'True) (S1 ('MetaSel ('Just "getZipList") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]))) type Rep1 ZipList # Instance detailsDefined in Control.Applicative type Rep1 ZipList = D1 ('MetaData "ZipList" "Control.Applicative" "base" 'True) (C1 ('MetaCons "ZipList" 'PrefixI 'True) (S1 ('MetaSel ('Just "getZipList") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 []))) # Utility functions (<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #

An infix synonym for fmap.

The name of this operator is an allusion to $. Note the similarities between their types:  ($)  ::              (a -> b) ->   a ->   b
(<$>) :: Functor f => (a -> b) -> f a -> f b Whereas $ is function application, <$> is function application lifted over a Functor. #### Examples Expand Convert from a Maybe Int to a Maybe String using show: >>> show <$> Nothing
Nothing
>>> show <$> Just 3 Just "3"  Convert from an Either Int Int to an Either Int String using show: >>> show <$> Left 17
Left 17
>>> show <$> Right 17 Right "17"  Double each element of a list: >>> (*2) <$> [1,2,3]
[2,4,6]


Apply even to the second element of a pair:

>>> even <$> (2,2) (2,True)  (<$) :: Functor f => a -> f b -> f a infixl 4 #

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4 #

A variant of <*> with the arguments reversed.

liftA :: Applicative f => (a -> b) -> f a -> f b #

Lift a function to actions. This function may be used as a value for fmap in a Functor instance.

liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d #

Lift a ternary function to actions.

optional :: Alternative f => f a -> f (Maybe a) #

One or none.