lens-5.0.1: Lenses, Folds and Traversals

Control.Lens.Combinators

Description

This lets the subset of users who vociferously disagree about the full scope and set of operators that should be exported from lens to not have to look at any operator with which they disagree.

import Control.Lens.Combinators
Synopsis

Documentation

class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where Source #

Functors representing data structures that can be traversed from left to right.

A definition of traverse must satisfy the following laws:

Naturality
t . traverse f = traverse (t . f) for every applicative transformation t
Identity
traverse Identity = Identity
Composition
traverse (Compose . fmap g . f) = Compose . fmap (traverse g) . traverse f

A definition of sequenceA must satisfy the following laws:

Naturality
t . sequenceA = sequenceA . fmap t for every applicative transformation t
Identity
sequenceA . fmap Identity = Identity
Composition
sequenceA . fmap Compose = Compose . fmap sequenceA . sequenceA

where an applicative transformation is a function

t :: (Applicative f, Applicative g) => f a -> g a

preserving the Applicative operations, i.e.

t (pure x) = pure x
t (f <*> x) = t f <*> t x


and the identity functor Identity and composition functors Compose are from Data.Functor.Identity and Data.Functor.Compose.

A result of the naturality law is a purity law for traverse

traverse pure = pure

(The naturality law is implied by parametricity and thus so is the purity law [1, p15].)

Instances are similar to Functor, e.g. given a data type

data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)

a suitable instance would be

instance Traversable Tree where
traverse f Empty = pure Empty
traverse f (Leaf x) = Leaf <$> f x traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r

This is suitable even for abstract types, as the laws for <*> imply a form of associativity.

The superclass instances should satisfy the following:

• In the Functor instance, fmap should be equivalent to traversal with the identity applicative functor (fmapDefault).
• In the Foldable instance, foldMap should be equivalent to traversal with a constant applicative functor (foldMapDefault).

References: [1] The Essence of the Iterator Pattern, Jeremy Gibbons and Bruno C. d. S. Oliveira

Minimal complete definition

Methods

traverse :: Applicative f => (a -> f b) -> t a -> f (t b) Source #

Map each element of a structure to an action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see traverse_.

Instances

Instances details

class Contravariant (f :: Type -> Type) where Source #

The class of contravariant functors.

Whereas in Haskell, one can think of a Functor as containing or producing values, a contravariant functor is a functor that can be thought of as consuming values.

As an example, consider the type of predicate functions a -> Bool. One such predicate might be negative x = x < 0, which classifies integers as to whether they are negative. However, given this predicate, we can re-use it in other situations, providing we have a way to map values to integers. For instance, we can use the negative predicate on a person's bank balance to work out if they are currently overdrawn:

newtype Predicate a = Predicate { getPredicate :: a -> Bool }

instance Contravariant Predicate where
contramap f (Predicate p) = Predicate (p . f)
|   - First, map the input...
----- then apply the predicate.

overdrawn :: Predicate Person
overdrawn = contramap personBankBalance negative


Any instance should be subject to the following laws:

Identity
contramap id = id
Composition
contramap (g . f) = contramap f . contramap g

Note, that the second law follows from the free theorem of the type of contramap and the first law, so you need only check that the former condition holds.

Minimal complete definition

contramap

Methods

contramap :: (a -> b) -> f b -> f a Source #

(>$) :: b -> f b -> f a infixl 4 Source # Replace all locations in the output with the same value. The default definition is contramap . const, but this may be overridden with a more efficient version. Instances Instances details  A Predicate is a Contravariant Functor, because contramap can apply its function argument to the input of the predicate. Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Predicate b -> Predicate a Source #(>$) :: b -> Predicate b -> Predicate a Source # A Comparison is a Contravariant Functor, because contramap can apply its function argument to each input of the comparison function. Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Comparison b -> Comparison a Source #(>$) :: b -> Comparison b -> Comparison a Source # Equivalence relations are Contravariant, because you can apply the contramapped function to each input to the equivalence relation. Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Equivalence b -> Equivalence a Source #(>$) :: b -> Equivalence b -> Equivalence a Source # Contravariant (V1 :: Type -> Type) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> V1 b -> V1 a Source #(>$) :: b -> V1 b -> V1 a Source # Contravariant (U1 :: Type -> Type) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> U1 b -> U1 a Source #(>$) :: b -> U1 b -> U1 a Source # Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a0 -> b) -> Op a b -> Op a a0 Source #(>$) :: b -> Op a b -> Op a a0 Source # Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Proxy b -> Proxy a Source #(>$) :: b -> Proxy b -> Proxy a Source # Instance detailsDefined in Control.Monad.Trans.Maybe Methodscontramap :: (a -> b) -> MaybeT m b -> MaybeT m a Source #(>$) :: b -> MaybeT m b -> MaybeT m a Source # Instance detailsDefined in Control.Monad.Trans.List Methodscontramap :: (a -> b) -> ListT m b -> ListT m a Source #(>$) :: b -> ListT m b -> ListT m a Source # Source # Instance detailsDefined in Control.Lens.Internal.Indexed Methodscontramap :: (a -> b) -> Indexing64 f b -> Indexing64 f a Source #(>$) :: b -> Indexing64 f b -> Indexing64 f a Source # Source # Instance detailsDefined in Control.Lens.Internal.Indexed Methodscontramap :: (a -> b) -> Indexing f b -> Indexing f a Source #(>$) :: b -> Indexing f b -> Indexing f a Source # Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Rec1 f b -> Rec1 f a Source #(>$) :: b -> Rec1 f b -> Rec1 f a Source # Contravariant (Const a :: Type -> Type) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a0 -> b) -> Const a b -> Const a a0 Source #(>$) :: b -> Const a b -> Const a a0 Source # Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Alt f b -> Alt f a Source #(>$) :: b -> Alt f b -> Alt f a Source # Instance detailsDefined in Control.Monad.Trans.Identity Methodscontramap :: (a -> b) -> IdentityT f b -> IdentityT f a Source #(>$) :: b -> IdentityT f b -> IdentityT f a Source # (Functor f, Contravariant g) => Contravariant (ComposeFC f g) Instance detailsDefined in Data.Functor.Contravariant.Compose Methodscontramap :: (a -> b) -> ComposeFC f g b -> ComposeFC f g a Source #(>$) :: b -> ComposeFC f g b -> ComposeFC f g a Source # (Contravariant f, Functor g) => Contravariant (ComposeCF f g) Instance detailsDefined in Data.Functor.Contravariant.Compose Methodscontramap :: (a -> b) -> ComposeCF f g b -> ComposeCF f g a Source #(>$) :: b -> ComposeCF f g b -> ComposeCF f g a Source # Contravariant m => Contravariant (ExceptT e m) Instance detailsDefined in Control.Monad.Trans.Except Methodscontramap :: (a -> b) -> ExceptT e m b -> ExceptT e m a Source #(>$) :: b -> ExceptT e m b -> ExceptT e m a Source # Contravariant m => Contravariant (ErrorT e m) Instance detailsDefined in Control.Monad.Trans.Error Methodscontramap :: (a -> b) -> ErrorT e m b -> ErrorT e m a Source #(>$) :: b -> ErrorT e m b -> ErrorT e m a Source # Contravariant m => Contravariant (ReaderT r m) Instance detailsDefined in Control.Monad.Trans.Reader Methodscontramap :: (a -> b) -> ReaderT r m b -> ReaderT r m a Source #(>$) :: b -> ReaderT r m b -> ReaderT r m a Source # Contravariant m => Contravariant (StateT s m) Instance detailsDefined in Control.Monad.Trans.State.Lazy Methodscontramap :: (a -> b) -> StateT s m b -> StateT s m a Source #(>$) :: b -> StateT s m b -> StateT s m a Source # Contravariant m => Contravariant (StateT s m) Instance detailsDefined in Control.Monad.Trans.State.Strict Methodscontramap :: (a -> b) -> StateT s m b -> StateT s m a Source #(>$) :: b -> StateT s m b -> StateT s m a Source # Contravariant m => Contravariant (WriterT w m) Instance detailsDefined in Control.Monad.Trans.Writer.Lazy Methodscontramap :: (a -> b) -> WriterT w m b -> WriterT w m a Source #(>$) :: b -> WriterT w m b -> WriterT w m a Source # Contravariant m => Contravariant (WriterT w m) Instance detailsDefined in Control.Monad.Trans.Writer.Strict Methodscontramap :: (a -> b) -> WriterT w m b -> WriterT w m a Source #(>$) :: b -> WriterT w m b -> WriterT w m a Source # Contravariant (Constant a :: Type -> Type) Instance detailsDefined in Data.Functor.Constant Methodscontramap :: (a0 -> b) -> Constant a b -> Constant a a0 Source #(>$) :: b -> Constant a b -> Constant a a0 Source # Derived instance. Instance detailsDefined in Data.Functor.Reverse Methodscontramap :: (a -> b) -> Reverse f b -> Reverse f a Source #(>$) :: b -> Reverse f b -> Reverse f a Source # Derived instance. Instance detailsDefined in Control.Applicative.Backwards Methodscontramap :: (a -> b) -> Backwards f b -> Backwards f a Source #(>$) :: b -> Backwards f b -> Backwards f a Source # Source # Instance detailsDefined in Control.Lens.Internal.Getter Methodscontramap :: (a0 -> b) -> AlongsideRight f a b -> AlongsideRight f a a0 Source #(>$) :: b -> AlongsideRight f a b -> AlongsideRight f a a0 Source # Source # Instance detailsDefined in Control.Lens.Internal.Getter Methodscontramap :: (a -> b0) -> AlongsideLeft f b b0 -> AlongsideLeft f b a Source #(>$) :: b0 -> AlongsideLeft f b b0 -> AlongsideLeft f b a Source # Contravariant (Effect m r) Source # Instance detailsDefined in Control.Lens.Internal.Zoom Methodscontramap :: (a -> b) -> Effect m r b -> Effect m r a Source #(>$) :: b -> Effect m r b -> Effect m r a Source # Contravariant (K1 i c :: Type -> Type) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> K1 i c b -> K1 i c a Source #(>$) :: b -> K1 i c b -> K1 i c a Source # (Contravariant f, Contravariant g) => Contravariant (f :+: g) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> (f :+: g) b -> (f :+: g) a Source #(>$) :: b -> (f :+: g) b -> (f :+: g) a Source # (Contravariant f, Contravariant g) => Contravariant (f :*: g) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> (f :*: g) b -> (f :*: g) a Source #(>$) :: b -> (f :*: g) b -> (f :*: g) a Source # (Contravariant f, Contravariant g) => Contravariant (Product f g) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Product f g b -> Product f g a Source #(>$) :: b -> Product f g b -> Product f g a Source # (Contravariant f, Contravariant g) => Contravariant (Sum f g) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Sum f g b -> Sum f g a Source #(>$) :: b -> Sum f g b -> Sum f g a Source # Contravariant f => Contravariant (Star f a) Instance detailsDefined in Data.Profunctor.Types Methodscontramap :: (a0 -> b) -> Star f a b -> Star f a a0 Source #(>$) :: b -> Star f a b -> Star f a a0 Source # Contravariant (Forget r a :: Type -> Type) Instance detailsDefined in Data.Profunctor.Types Methodscontramap :: (a0 -> b) -> Forget r a b -> Forget r a a0 Source #(>$) :: b -> Forget r a b -> Forget r a a0 Source # Contravariant f => Contravariant (M1 i c f) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> M1 i c f b -> M1 i c f a Source #(>$) :: b -> M1 i c f b -> M1 i c f a Source # (Functor f, Contravariant g) => Contravariant (f :.: g) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> (f :.: g) b -> (f :.: g) a Source #(>$) :: b -> (f :.: g) b -> (f :.: g) a Source # (Functor f, Contravariant g) => Contravariant (Compose f g) Instance detailsDefined in Data.Functor.Contravariant Methodscontramap :: (a -> b) -> Compose f g b -> Compose f g a Source #(>$) :: b -> Compose f g b -> Compose f g a Source # Contravariant m => Contravariant (RWST r w s m) Instance detailsDefined in Control.Monad.Trans.RWS.Lazy Methodscontramap :: (a -> b) -> RWST r w s m b -> RWST r w s m a Source #(>$) :: b -> RWST r w s m b -> RWST r w s m a Source # Contravariant m => Contravariant (RWST r w s m) Instance detailsDefined in Control.Monad.Trans.RWS.Strict Methodscontramap :: (a -> b) -> RWST r w s m b -> RWST r w s m a Source #(>$) :: b -> RWST r w s m b -> RWST r w s m a Source # (Profunctor p, Contravariant g) => Contravariant (PretextT p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodscontramap :: (a0 -> b0) -> PretextT p g a b b0 -> PretextT p g a b a0 Source #(>$) :: b0 -> PretextT p g a b b0 -> PretextT p g a b a0 Source # (Profunctor p, Contravariant g) => Contravariant (BazaarT1 p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodscontramap :: (a0 -> b0) -> BazaarT1 p g a b b0 -> BazaarT1 p g a b a0 Source #(>$) :: b0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b a0 Source # (Profunctor p, Contravariant g) => Contravariant (BazaarT p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodscontramap :: (a0 -> b0) -> BazaarT p g a b b0 -> BazaarT p g a b a0 Source #(>$) :: b0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 Source # Contravariant f => Contravariant (TakingWhile p f a b) Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodscontramap :: (a0 -> b0) -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 Source #(>$) :: b0 -> TakingWhile p f a b b0 -> TakingWhile p f a b a0 Source # Contravariant (EffectRWS w st m s) Source # Instance detailsDefined in Control.Lens.Internal.Zoom Methodscontramap :: (a -> b) -> EffectRWS w st m s b -> EffectRWS w st m s a Source #(>$) :: b -> EffectRWS w st m s b -> EffectRWS w st m s a Source #

class Bifunctor (p :: Type -> Type -> Type) where Source #

A bifunctor is a type constructor that takes two type arguments and is a functor in both arguments. That is, unlike with Functor, a type constructor such as Either does not need to be partially applied for a Bifunctor instance, and the methods in this class permit mapping functions over the Left value or the Right value, or both at the same time.

Formally, the class Bifunctor represents a bifunctor from Hask -> Hask.

Intuitively it is a bifunctor where both the first and second arguments are covariant.

You can define a Bifunctor by either defining bimap or by defining both first and second.

If you supply bimap, you should ensure that:

bimap id id ≡ id

If you supply first and second, ensure:

first id ≡ id
second id ≡ id


If you supply both, you should also ensure:

bimap f g ≡ first f . second g

These ensure by parametricity:

bimap  (f . g) (h . i) ≡ bimap f h . bimap g i
first  (f . g) ≡ first  f . first  g
second (f . g) ≡ second f . second g


Since: base-4.8.0.0

Minimal complete definition

Methods

bimap :: (a -> b) -> (c -> d) -> p a c -> p b d Source #

Map over both arguments at the same time.

bimap f g ≡ first f . second g

Examples

Expand
>>> bimap toUpper (+1) ('j', 3)
('J',4)

>>> bimap toUpper (+1) (Left 'j')
Left 'J'

>>> bimap toUpper (+1) (Right 3)
Right 4


Instances

Instances details
 Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d Source #first :: (a -> b) -> Either a c -> Either b c Source #second :: (b -> c) -> Either a b -> Either a c Source # Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> (a, c) -> (b, d) Source #first :: (a -> b) -> (a, c) -> (b, c) Source #second :: (b -> c) -> (a, b) -> (a, c) Source # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodsbimap :: (a -> b) -> (c -> d) -> Arg a c -> Arg b d Source #first :: (a -> b) -> Arg a c -> Arg b c Source #second :: (b -> c) -> Arg a b -> Arg a c Source # Instance detailsDefined in Data.Strict.Tuple Methodsbimap :: (a -> b) -> (c -> d) -> Pair a c -> Pair b d Source #first :: (a -> b) -> Pair a c -> Pair b c Source #second :: (b -> c) -> Pair a b -> Pair a c Source # Instance detailsDefined in Data.Strict.These Methodsbimap :: (a -> b) -> (c -> d) -> These a c -> These b d Source #first :: (a -> b) -> These a c -> These b c Source #second :: (b -> c) -> These a b -> These a c Source # Instance detailsDefined in Data.Strict.Either Methodsbimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d Source #first :: (a -> b) -> Either a c -> Either b c Source #second :: (b -> c) -> Either a b -> Either a c Source # Instance detailsDefined in Data.These Methodsbimap :: (a -> b) -> (c -> d) -> These a c -> These b d Source #first :: (a -> b) -> These a c -> These b c Source #second :: (b -> c) -> These a b -> These a c Source # Bifunctor ((,,) x1) Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> (x1, a, c) -> (x1, b, d) Source #first :: (a -> b) -> (x1, a, c) -> (x1, b, c) Source #second :: (b -> c) -> (x1, a, b) -> (x1, a, c) Source # 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 Source #first :: (a -> b) -> Const a c -> Const b c Source #second :: (b -> c) -> Const a b -> Const a c Source # Functor f => Bifunctor (FreeF f) Instance detailsDefined in Control.Monad.Trans.Free Methodsbimap :: (a -> b) -> (c -> d) -> FreeF f a c -> FreeF f b d Source #first :: (a -> b) -> FreeF f a c -> FreeF f b c Source #second :: (b -> c) -> FreeF f a b -> FreeF f a c Source # Functor f => Bifunctor (CofreeF f) Instance detailsDefined in Control.Comonad.Trans.Cofree Methodsbimap :: (a -> b) -> (c -> d) -> CofreeF f a c -> CofreeF f b d Source #first :: (a -> b) -> CofreeF f a c -> CofreeF f b c Source #second :: (b -> c) -> CofreeF f a b -> CofreeF f a c Source # Bifunctor (Constant :: Type -> Type -> Type) Instance detailsDefined in Data.Functor.Constant Methodsbimap :: (a -> b) -> (c -> d) -> Constant a c -> Constant b d Source #first :: (a -> b) -> Constant a c -> Constant b c Source #second :: (b -> c) -> Constant a b -> Constant a c Source # Bifunctor (Tagged :: Type -> Type -> Type) Instance detailsDefined in Data.Tagged Methodsbimap :: (a -> b) -> (c -> d) -> Tagged a c -> Tagged b d Source #first :: (a -> b) -> Tagged a c -> Tagged b c Source #second :: (b -> c) -> Tagged a b -> Tagged a c Source # Source # Instance detailsDefined in Control.Lens.Internal.Getter Methodsbimap :: (a -> b) -> (c -> d) -> AlongsideRight f a c -> AlongsideRight f b d Source #first :: (a -> b) -> AlongsideRight f a c -> AlongsideRight f b c Source #second :: (b -> c) -> AlongsideRight f a b -> AlongsideRight f a c Source # Source # Instance detailsDefined in Control.Lens.Internal.Getter Methodsbimap :: (a -> b) -> (c -> d) -> AlongsideLeft f a c -> AlongsideLeft f b d Source #first :: (a -> b) -> AlongsideLeft f a c -> AlongsideLeft f b c Source #second :: (b -> c) -> AlongsideLeft f a b -> AlongsideLeft f a c Source # Bifunctor (K1 i :: Type -> Type -> Type) Since: base-4.9.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> K1 i a c -> K1 i b d Source #first :: (a -> b) -> K1 i a c -> K1 i b c Source #second :: (b -> c) -> K1 i a b -> K1 i a c Source # Bifunctor ((,,,) x1 x2) Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> (x1, x2, a, c) -> (x1, x2, b, d) Source #first :: (a -> b) -> (x1, x2, a, c) -> (x1, x2, b, c) Source #second :: (b -> c) -> (x1, x2, a, b) -> (x1, x2, a, c) Source # Bifunctor ((,,,,) x1 x2 x3) Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> (x1, x2, x3, a, c) -> (x1, x2, x3, b, d) Source #first :: (a -> b) -> (x1, x2, x3, a, c) -> (x1, x2, x3, b, c) Source #second :: (b -> c) -> (x1, x2, x3, a, b) -> (x1, x2, x3, a, c) Source # Instance detailsDefined in Data.Bifunctor.Wrapped Methodsbimap :: (a -> b) -> (c -> d) -> WrappedBifunctor p a c -> WrappedBifunctor p b d Source #first :: (a -> b) -> WrappedBifunctor p a c -> WrappedBifunctor p b c Source #second :: (b -> c) -> WrappedBifunctor p a b -> WrappedBifunctor p a c Source # Functor g => Bifunctor (Joker g :: Type -> Type -> Type) Instance detailsDefined in Data.Bifunctor.Joker Methodsbimap :: (a -> b) -> (c -> d) -> Joker g a c -> Joker g b d Source #first :: (a -> b) -> Joker g a c -> Joker g b c Source #second :: (b -> c) -> Joker g a b -> Joker g a c Source # Bifunctor p => Bifunctor (Flip p) Instance detailsDefined in Data.Bifunctor.Flip Methodsbimap :: (a -> b) -> (c -> d) -> Flip p a c -> Flip p b d Source #first :: (a -> b) -> Flip p a c -> Flip p b c Source #second :: (b -> c) -> Flip p a b -> Flip p a c Source # Functor f => Bifunctor (Clown f :: Type -> Type -> Type) Instance detailsDefined in Data.Bifunctor.Clown Methodsbimap :: (a -> b) -> (c -> d) -> Clown f a c -> Clown f b d Source #first :: (a -> b) -> Clown f a c -> Clown f b c Source #second :: (b -> c) -> Clown f a b -> Clown f a c Source # Bifunctor ((,,,,,) x1 x2 x3 x4) Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> (x1, x2, x3, x4, a, c) -> (x1, x2, x3, x4, b, d) Source #first :: (a -> b) -> (x1, x2, x3, x4, a, c) -> (x1, x2, x3, x4, b, c) Source #second :: (b -> c) -> (x1, x2, x3, x4, a, b) -> (x1, x2, x3, x4, a, c) Source # (Bifunctor p, Bifunctor q) => Bifunctor (Sum p q) Instance detailsDefined in Data.Bifunctor.Sum Methodsbimap :: (a -> b) -> (c -> d) -> Sum p q a c -> Sum p q b d Source #first :: (a -> b) -> Sum p q a c -> Sum p q b c Source #second :: (b -> c) -> Sum p q a b -> Sum p q a c Source # (Bifunctor f, Bifunctor g) => Bifunctor (Product f g) Instance detailsDefined in Data.Bifunctor.Product Methodsbimap :: (a -> b) -> (c -> d) -> Product f g a c -> Product f g b d Source #first :: (a -> b) -> Product f g a c -> Product f g b c Source #second :: (b -> c) -> Product f g a b -> Product f g a c Source # Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) Since: base-4.8.0.0 Instance detailsDefined in Data.Bifunctor Methodsbimap :: (a -> b) -> (c -> d) -> (x1, x2, x3, x4, x5, a, c) -> (x1, x2, x3, x4, x5, b, d) Source #first :: (a -> b) -> (x1, x2, x3, x4, x5, a, c) -> (x1, x2, x3, x4, x5, b, c) Source #second :: (b -> c) -> (x1, x2, x3, x4, x5, a, b) -> (x1, x2, x3, x4, x5, a, c) Source # (Functor f, Bifunctor p) => Bifunctor (Tannen f p) Instance detailsDefined in Data.Bifunctor.Tannen Methodsbimap :: (a -> b) -> (c -> d) -> Tannen f p a c -> Tannen f p b d Source #first :: (a -> b) -> Tannen f p a c -> Tannen f p b c Source #second :: (b -> c) -> Tannen f p a b -> Tannen f p a c Source # (Bifunctor p, Functor f, Functor g) => Bifunctor (Biff p f g) Instance detailsDefined in Data.Bifunctor.Biff Methodsbimap :: (a -> b) -> (c -> d) -> Biff p f g a c -> Biff p f g b d Source #first :: (a -> b) -> Biff p f g a c -> Biff p f g b c Source #second :: (b -> c) -> Biff p f g a b -> Biff p f g a c Source #

newtype Identity a Source #

 Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methods(>>=) :: Identity a -> (a -> Identity b) -> Identity b Source #(>>) :: Identity a -> Identity b -> Identity b Source #return :: a -> Identity a Source # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodsfmap :: (a -> b) -> Identity a -> Identity b Source #(<\$) :: a -> Identity b -> Identity a Source # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodsmfix :: (a -> Identity a) -> Identity a Source # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodspure :: a -> Identity a Source #(<*>) :: Identity (a -> b) -> Identity a -> Identity b Source #liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source #(*>) :: Identity a -> Identity b -> Identity b Source #(<*) :: Identity a -> Identity b -> Identity a Source # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodsfold :: Monoid m => Identity m -> m Source #foldMap :: Monoid m => (a -> m) -> Identity a -> m Source #foldMap' :: Monoid m => (a -> m) -> Identity a -> m Source #foldr :: (a -> b -> b) -> b -> Identity a -> b Source #foldr' :: (a -> b -> b) -> b -> Identity a -> b Source #foldl :: (b -> a -> b) -> b -> Identity a -> b Source #foldl' :: (b -> a -> b) -> b -> Identity a -> b Source #foldr1 :: (a -> a -> a) -> Identity a -> a Source #foldl1 :: (a -> a -> a) -> Identity a -> a Source #toList :: Identity a -> [a] Source #null :: Identity a -> Bool Source #length :: Identity a -> Int Source #elem :: Eq a => a -> Identity a -> Bool Source #maximum :: Ord a => Identity a -> a Source #minimum :: Ord a => Identity a -> a Source #sum :: Num a => Identity a -> a Source #product :: Num a => Identity a -> a Source # Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) Source #sequenceA :: Applicative f => Identity (f a) -> f (Identity a) Source #mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) Source #sequence :: Monad m => Identity (m a) -> m (Identity a) Source # Instance detailsDefined in Data.Distributive Methodsdistribute :: Functor f => f (Identity a) -> Identity (f a) Source #collect :: Functor f => (a -> Identity b) -> f a -> Identity (f b) Source #distributeM :: Monad m => m (Identity a) -> Identity (m a) Source #collectM :: Monad m => (a -> Identity b) -> m a -> Identity (m b) Source # Instance detailsDefined in Data.Functor.Rep Associated Types Methodstabulate :: (Rep Identity -> a) -> Identity a Source #index :: Identity a -> Rep Identity -> a Source # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool Source # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering Source # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) Source #liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] Source #liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) Source #liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] Source # Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Classes MethodsliftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS Source #liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS Source # Instance detailsDefined in Control.Comonad Methodsextract :: Identity a -> a Source #extend :: (Identity a -> b) -> Identity a -> Identity b Source # Instance detailsDefined in Control.Comonad Methods(<@>) :: Identity (a -> b) -> Identity a -> Identity b Source #(@>) :: Identity a -> Identity b -> Identity b Source #(<@) :: Identity a -> Identity b -> Identity a Source # Since: deepseq-1.4.3.0 Instance detailsDefined in Control.DeepSeq MethodsliftRnf :: (a -> ()) -> Identity a -> () Source # Instance detailsDefined in Data.Hashable.Class MethodsliftHashWithSalt :: (Int -> a -> Int) -> Int -> Identity a -> Int Source # Instance detailsDefined in Data.Semigroup.Traversable.Class Methodstraverse1 :: Apply f => (a -> f b) -> Identity a -> f (Identity b) Source #sequence1 :: Apply f => Identity (f b) -> f (Identity b) Source # Choose the first option every time. While 'choose the last option' every time is also valid, this instance satisfies more laws.Since: semigroupoids-5.3.6 Instance detailsDefined in Data.Functor.Alt Methods() :: Identity a -> Identity a -> Identity a Source # Instance detailsDefined in Data.Functor.Bind.Class Methods(<.>) :: Identity (a -> b) -> Identity a -> Identity b Source #(.>) :: Identity a -> Identity b -> Identity b Source #(<.) :: Identity a -> Identity b -> Identity a Source #liftF2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source # Instance detailsDefined in Data.Functor.Bind.Class Methods(>>-) :: Identity a -> (a -> Identity b) -> Identity b Source #join :: Identity (Identity a) -> Identity a Source # Instance detailsDefined in Data.Semigroup.Foldable.Class Methodsfold1 :: Semigroup m => Identity m -> m Source #foldMap1 :: Semigroup m => (a -> m) -> Identity a -> m Source # Instance detailsDefined in Data.Functor.Extend Methodsextended :: (Identity a -> b) -> Identity a -> Identity b Source # Source # So you can pass our Setter into combinators from other lens libraries. Instance detailsDefined in Control.Lens.Internal.Setter Methodsuntainted :: Identity a -> a Source #untaintedDot :: Profunctor p => p a (Identity b) -> p a b Source #taintedDot :: Profunctor p => p a b -> p a (Identity b) Source # Instance detailsDefined in WithIndex Methodsimap :: (() -> a -> b) -> Identity a -> Identity b Source # Instance detailsDefined in WithIndex MethodsifoldMap :: Monoid m => (() -> a -> m) -> Identity a -> m Source #ifoldMap' :: Monoid m => (() -> a -> m) -> Identity a -> m Source #ifoldr :: (() -> a -> b -> b) -> b -> Identity a -> b Source #ifoldl :: (() -> b -> a -> b) -> b -> Identity a -> b Source #ifoldr' :: (() -> a -> b -> b) -> b -> Identity a -> b Source #ifoldl' :: (() -> b -> a -> b) -> b -> Identity a -> b Source # Instance detailsDefined in WithIndex Methodsitraverse :: Applicative f => (() -> a -> f b) -> Identity a -> f (Identity b) Source # Source # Instance detailsDefined in Control.Lens.Reified Methodssieve :: ReifiedGetter a b -> a -> Identity b Source # Source # Instance detailsDefined in Control.Lens.Reified Methodscosieve :: ReifiedGetter a b -> Identity a -> b Source # Monad m => MonadFree Identity (IterT m) Instance detailsDefined in Control.Monad.Trans.Iter Methodswrap :: Identity (IterT m a) -> IterT m a Source # Instance detailsDefined in Control.Comonad.Trans.Coiter Methodsunwrap :: CoiterT w a -> Identity (CoiterT w a) Source # Unbox a => Vector Vector (Identity a) Instance detailsDefined in Data.Vector.Unboxed.Base MethodsbasicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Identity a) -> m (Vector (Identity a)) Source #basicUnsafeThaw :: PrimMonad m => Vector (Identity a) -> m (Mutable Vector (PrimState m) (Identity a)) Source #basicUnsafeSlice :: Int -> Int -> Vector (Identity a) -> Vector (Identity a) Source #basicUnsafeIndexM :: Monad m => Vector (Identity a) -> Int -> m (Identity a) Source #basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Identity a) -> Vector (Identity a) -> m () Source #elemseq :: Vector (Identity a) -> Identity a -> b -> b Source # Unbox a => MVector MVector (Identity a) Instance detailsDefined in Data.Vector.Unboxed.Base MethodsbasicLength :: MVector s (Identity a) -> Int Source #basicUnsafeSlice :: Int -> Int -> MVector s (Identity a) -> MVector s (Identity a) Source #basicOverlaps :: MVector s (Identity a) -> MVector s (Identity a) -> Bool Source #basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Identity a)) Source #basicInitialize :: PrimMonad m => MVector (PrimState m) (Identity a) -> m () Source #basicUnsafeReplicate :: PrimMonad m => Int -> Identity a -> m (MVector (PrimState m) (Identity a)) Source #basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Identity a) -> Int -> m (Identity a) Source #basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Identity a) -> Int -> Identity a -> m () Source #basicClear :: PrimMonad m => MVector (PrimState m) (Identity a) -> m () Source #basicSet :: PrimMonad m => MVector (PrimState m) (Identity a) -> Identity a -> m () Source #basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Identity a) -> MVector (PrimState m) (Identity a) -> m () Source #basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Identity a) -> MVector (PrimState m) (Identity a) -> m () Source #basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Identity a) -> Int -> m (MVector (PrimState m) (Identity a)) Source # Bounded a => Bounded (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods Enum a => Enum (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methodssucc :: Identity a -> Identity a Source #pred :: Identity a -> Identity a Source #enumFrom :: Identity a -> [Identity a] Source #enumFromThen :: Identity a -> Identity a -> [Identity a] Source #enumFromTo :: Identity a -> Identity a -> [Identity a] Source #enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] Source # Eq a => Eq (Identity a) Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methods(==) :: Identity a -> Identity a -> Bool Source #(/=) :: Identity a -> Identity a -> Bool Source # Floating a => Floating (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methodsexp :: Identity a -> Identity a Source #log :: Identity a -> Identity a Source #sqrt :: Identity a -> Identity a Source #(**) :: Identity a -> Identity a -> Identity a Source #logBase :: Identity a -> Identity a -> Identity a Source #sin :: Identity a -> Identity a Source #cos :: Identity a -> Identity a Source #tan :: Identity a -> Identity a Source #asin :: Identity a -> Identity a Source #acos :: Identity a -> Identity a Source #atan :: Identity a -> Identity a Source #sinh :: Identity a -> Identity a Source #cosh :: Identity a -> Identity a Source #tanh :: Identity a -> Identity a Source #asinh :: Identity a -> Identity a Source #acosh :: Identity a -> Identity a Source #atanh :: Identity a -> Identity a Source #log1p :: Identity a -> Identity a Source #expm1 :: Identity a -> Identity a Source # Fractional a => Fractional (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods(/) :: Identity a -> Identity a -> Identity a Source #recip :: Identity a -> Identity a Source # Integral a => Integral (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methodsquot :: Identity a -> Identity a -> Identity a Source #rem :: Identity a -> Identity a -> Identity a Source #div :: Identity a -> Identity a -> Identity a Source #mod :: Identity a -> Identity a -> Identity a Source #quotRem :: Identity a -> Identity a -> (Identity a, Identity a) Source #divMod :: Identity a -> Identity a -> (Identity a, Identity a) Source # Data a => Data (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Data Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Identity a -> c (Identity a) Source #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Identity a) Source #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Identity a)) Source #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Identity a)) Source #gmapT :: (forall b. Data b => b -> b) -> Identity a -> Identity a Source #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r Source #gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r Source #gmapQ :: (forall d. Data d => d -> u) -> Identity a -> [u] Source #gmapQi :: Int -> (forall d. Data d => d -> u) -> Identity a -> u Source #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source # Num a => Num (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods(+) :: Identity a -> Identity a -> Identity a Source #(-) :: Identity a -> Identity a -> Identity a Source #(*) :: Identity a -> Identity a -> Identity a Source #abs :: Identity a -> Identity a Source # Ord a => Ord (Identity a) Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodscompare :: Identity a -> Identity a -> Ordering Source #(<) :: Identity a -> Identity a -> Bool Source #(<=) :: Identity a -> Identity a -> Bool Source #(>) :: Identity a -> Identity a -> Bool Source #(>=) :: Identity a -> Identity a -> Bool Source #max :: Identity a -> Identity a -> Identity a Source #min :: Identity a -> Identity a -> Identity a Source # Read a => Read (Identity a) This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removedSince: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methods Real a => Real (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods RealFloat a => RealFloat (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity MethodsfloatRange :: Identity a -> (Int, Int) Source #decodeFloat :: Identity a -> (Integer, Int) Source #scaleFloat :: Int -> Identity a -> Identity a Source #isNaN :: Identity a -> Bool Source #atan2 :: Identity a -> Identity a -> Identity a Source # RealFrac a => RealFrac (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity MethodsproperFraction :: Integral b => Identity a -> (b, Identity a) Source #truncate :: Integral b => Identity a -> b Source #round :: Integral b => Identity a -> b Source #ceiling :: Integral b => Identity a -> b Source #floor :: Integral b => Identity a -> b Source # Show a => Show (Identity a) This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removedSince: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity MethodsshowsPrec :: Int -> Identity a -> ShowS Source #showList :: [Identity a] -> ShowS Source # Ix a => Ix (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methodsrange :: (Identity a, Identity a) -> [Identity a] Source #index :: (Identity a, Identity a) -> Identity a -> Int Source #unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int Source #inRange :: (Identity a, Identity a) -> Identity a -> Bool Source #rangeSize :: (Identity a, Identity a) -> Int Source #unsafeRangeSize :: (Identity a, Identity a) -> Int Source # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Associated Typestype Rep (Identity a) :: Type -> Type Source # Methodsfrom :: Identity a -> Rep (Identity a) x Source #to :: Rep (Identity a) x -> Identity a Source # Semigroup a => Semigroup (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods(<>) :: Identity a -> Identity a -> Identity a Source #stimes :: Integral b => b -> Identity a -> Identity a Source # Monoid a => Monoid (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methodsmappend :: Identity a -> Identity a -> Identity a Source #mconcat :: [Identity a] -> Identity a Source # Storable a => Storable (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity MethodssizeOf :: Identity a -> Int Source #peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) Source #pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () Source #peekByteOff :: Ptr b -> Int -> IO (Identity a) Source #pokeByteOff :: Ptr b -> Int -> Identity a -> IO () Source #peek :: Ptr (Identity a) -> IO (Identity a) Source #poke :: Ptr (Identity a) -> Identity a -> IO () Source # Bits a => Bits (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods(.&.) :: Identity a -> Identity a -> Identity a Source #(.|.) :: Identity a -> Identity a -> Identity a Source #xor :: Identity a -> Identity a -> Identity a Source #shift :: Identity a -> Int -> Identity a Source #rotate :: Identity a -> Int -> Identity a Source #setBit :: Identity a -> Int -> Identity a Source #clearBit :: Identity a -> Int -> Identity a Source #testBit :: Identity a -> Int -> Bool Source #shiftL :: Identity a -> Int -> Identity a Source #shiftR :: Identity a -> Int -> Identity a Source #rotateL :: Identity a -> Int -> Identity a Source #rotateR :: Identity a -> Int -> Identity a Source # FiniteBits a => FiniteBits (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity MethodsfiniteBitSize :: Identity a -> Int