optics-core-0.4.1: Optics as an abstract interface: core definitions
Safe HaskellNone
LanguageHaskell2010

Optics.Optic

Description

This module provides core definitions:

  • an opaque Optic type, which is parameterised over a type representing an optic kind (instantiated with tag types such as A_Lens);
  • the optic composition operator (%);
  • the subtyping relation Is with an accompanying castOptic function to convert an optic kind;
  • the JoinKinds class used to find the optic kind resulting from a composition.

Each optic kind is identified by a "tag type" (such as A_Lens), which is an empty data type. The type of the actual optics (such as Lens) is obtained by applying Optic to the tag type.

See the Optics module in the main optics package for overview documentation.

Synopsis

Documentation

type OpticKind = Type Source #

Kind for types used as optic tags, such as A_Lens.

Since: 0.2

data Optic (k :: OpticKind) (is :: IxList) s t a b Source #

Wrapper newtype for the whole family of optics.

The first parameter k identifies the particular optic kind (e.g. A_Lens or A_Traversal).

The parameter is is a list of types available as indices. This will typically be NoIx for unindexed optics, or WithIx for optics with a single index. See the "Indexed optics" section of the overview documentation in the Optics module of the main optics package for more details.

The parameters s and t represent the "big" structure, whereas a and b represent the "small" structure.

Instances

Instances details
(LabelOptic name k s t a b, is ~ NoIx) => IsLabel name (Optic k is s t a b) Source # 
Instance details

Defined in Optics.Label

Methods

fromLabel :: Optic k is s t a b #

type Optic' k is s a = Optic k is s s a a Source #

Common special case of Optic where source and target types are equal.

Here, we need only one "big" and one "small" type. For lenses, this means that in the restricted form we cannot do type-changing updates.

Subtyping

castOptic :: forall destKind srcKind is s t a b. Is srcKind destKind => Optic srcKind is s t a b -> Optic destKind is s t a b Source #

Explicit cast from one optic flavour to another.

The resulting optic kind is given in the first type argument, so you can use TypeApplications to set it. For example

 castOptic @A_Lens o

turns o into a Lens.

This is the identity function, modulo some constraint jiggery-pokery.

class Is k l Source #

Subtyping relationship between kinds of optics.

An instance of Is k l means that any Optic k can be used as an Optic l. For example, we have an Is A_Lens A_Traversal instance, but not Is A_Traversal A_Lens.

This class needs instances for all possible combinations of tags.

Minimal complete definition

implies

Instances

Instances details
(TypeError (((('ShowType k :<>: 'Text " cannot be used as ") :<>: 'ShowType l) :$$: 'Text "Perhaps you meant one of these:") :$$: ShowEliminations (EliminationForms k)) :: Constraint) => Is k l Source #

Overlappable instance for a custom type error.

Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints k p => r) -> Constraints l p => r Source #

Is k k Source #

Every kind of optic can be used as itself.

Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints k p => r) -> Constraints k p => r Source #

Is A_ReversedLens A_Review Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_ReversedLens p => r) -> Constraints A_Review p => r Source #

Is An_AffineFold A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineFold p => r) -> Constraints A_Fold p => r Source #

Is A_Getter A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Getter p => r) -> Constraints A_Fold p => r Source #

Is A_Getter An_AffineFold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Getter p => r) -> Constraints An_AffineFold p => r Source #

Is A_ReversedPrism A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_ReversedPrism p => r) -> Constraints A_Fold p => r Source #

Is A_ReversedPrism An_AffineFold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_ReversedPrism p => r) -> Constraints An_AffineFold p => r Source #

Is A_ReversedPrism A_Getter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_ReversedPrism p => r) -> Constraints A_Getter p => r Source #

Is A_Traversal A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Traversal p => r) -> Constraints A_Fold p => r Source #

Is A_Traversal A_Setter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Traversal p => r) -> Constraints A_Setter p => r Source #

Is An_AffineTraversal A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineTraversal p => r) -> Constraints A_Fold p => r Source #

Is An_AffineTraversal An_AffineFold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineTraversal p => r) -> Constraints An_AffineFold p => r Source #

Is An_AffineTraversal A_Setter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineTraversal p => r) -> Constraints A_Setter p => r Source #

Is An_AffineTraversal A_Traversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineTraversal p => r) -> Constraints A_Traversal p => r Source #

Is A_Prism A_Review Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints A_Review p => r Source #

Is A_Prism A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints A_Fold p => r Source #

Is A_Prism An_AffineFold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints An_AffineFold p => r Source #

Is A_Prism A_Setter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints A_Setter p => r Source #

Is A_Prism A_Traversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints A_Traversal p => r Source #

Is A_Prism An_AffineTraversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints An_AffineTraversal p => r Source #

Is A_Lens A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints A_Fold p => r Source #

Is A_Lens An_AffineFold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints An_AffineFold p => r Source #

Is A_Lens A_Getter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints A_Getter p => r Source #

Is A_Lens A_Setter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints A_Setter p => r Source #

Is A_Lens A_Traversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints A_Traversal p => r Source #

Is A_Lens An_AffineTraversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints An_AffineTraversal p => r Source #

Is An_Iso A_Review Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Review p => r Source #

Is An_Iso A_ReversedLens Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_ReversedLens p => r Source #

Is An_Iso A_Fold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Fold p => r Source #

Is An_Iso An_AffineFold Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints An_AffineFold p => r Source #

Is An_Iso A_Getter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Getter p => r Source #

Is An_Iso A_ReversedPrism Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_ReversedPrism p => r Source #

Is An_Iso A_Setter Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Setter p => r Source #

Is An_Iso A_Traversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Traversal p => r Source #

Is An_Iso An_AffineTraversal Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints An_AffineTraversal p => r Source #

Is An_Iso A_Prism Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Prism p => r Source #

Is An_Iso A_Lens Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Lens p => r Source #

class JoinKinds k l m | k l -> m Source #

Computes the least upper bound of two optics kinds.

In presence of a JoinKinds k l m constraint Optic m represents the least upper bound of an Optic k and an Optic l. This means in particular that composition of an Optic k and an Optic k will yield an Optic m.

Since: 0.4

Minimal complete definition

joinKinds

Instances

Instances details
(JoinKinds k l m, TypeError (('ShowType k :<>: 'Text " cannot be composed with ") :<>: 'ShowType l) :: Constraint) => JoinKinds k l m Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints k p, Constraints l p) => r) -> Constraints m p => r Source #

k ~ A_Review => JoinKinds A_Review A_Review k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Review p, Constraints A_Review p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_Review A_ReversedLens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Review p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_Review A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Review p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_Review An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Review p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_ReversedLens A_Review k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints A_Review p) => r) -> Constraints k p => r Source #

k ~ A_ReversedLens => JoinKinds A_ReversedLens A_ReversedLens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_ReversedLens A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_ReversedLens => JoinKinds A_ReversedLens An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Fold An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds An_AffineFold A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds An_AffineFold A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineFold An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Getter A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Getter An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_Getter A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_Getter A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Getter A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Getter An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Getter A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_Getter A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_Getter An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_ReversedPrism A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_ReversedPrism An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_ReversedPrism A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ A_ReversedPrism => JoinKinds A_ReversedPrism A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_ReversedPrism A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_ReversedPrism An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_ReversedPrism A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_ReversedPrism A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_ReversedPrism => JoinKinds A_ReversedPrism An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Setter A_Setter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Setter p, Constraints A_Setter p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Setter A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Setter p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Setter An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Setter p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Setter A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Setter p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Setter A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Setter p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Setter An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Setter p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Traversal A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Traversal An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Traversal A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Traversal A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Traversal A_Setter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Setter p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Traversal A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Traversal An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Traversal A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Traversal A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Traversal An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds An_AffineTraversal A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineTraversal An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineTraversal A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_AffineTraversal A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds An_AffineTraversal A_Setter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Setter p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds An_AffineTraversal A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds An_AffineTraversal An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds An_AffineTraversal A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds An_AffineTraversal A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds An_AffineTraversal An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_Prism A_Review k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Review p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds A_Prism A_ReversedLens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Prism A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Prism An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Prism A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Prism A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Prism A_Setter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Setter p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Prism A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds A_Prism An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ A_Prism => JoinKinds A_Prism A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds A_Prism A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_Prism => JoinKinds A_Prism An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds A_Lens A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds A_Lens An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_Lens A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds A_Lens A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds A_Lens A_Setter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Setter p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds A_Lens A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds A_Lens An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds A_Lens A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Lens => JoinKinds A_Lens A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ A_Lens => JoinKinds A_Lens An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

k ~ A_Review => JoinKinds An_Iso A_Review k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Review p) => r) -> Constraints k p => r Source #

k ~ A_ReversedLens => JoinKinds An_Iso A_ReversedLens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

k ~ A_Fold => JoinKinds An_Iso A_Fold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Fold p) => r) -> Constraints k p => r Source #

k ~ An_AffineFold => JoinKinds An_Iso An_AffineFold k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #

k ~ A_Getter => JoinKinds An_Iso A_Getter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Getter p) => r) -> Constraints k p => r Source #

k ~ A_ReversedPrism => JoinKinds An_Iso A_ReversedPrism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #

k ~ A_Setter => JoinKinds An_Iso A_Setter k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Setter p) => r) -> Constraints k p => r Source #

k ~ A_Traversal => JoinKinds An_Iso A_Traversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #

k ~ An_AffineTraversal => JoinKinds An_Iso An_AffineTraversal k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #

k ~ A_Prism => JoinKinds An_Iso A_Prism k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

k ~ A_Lens => JoinKinds An_Iso A_Lens k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Lens p) => r) -> Constraints k p => r Source #

k ~ An_Iso => JoinKinds An_Iso An_Iso k Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

Composition

The usual operator for composing optics is (%), which allows different optic kinds to be composed, automatically calculating the resulting optic kind using JoinKinds.

The (.) function composition operator cannot be used to compose optics, because optics are not functions. The (.) operator from Control.Category cannot be used either, because it would not support type-changing optics or composing optics of different kinds.

(%) :: forall k l m is js ks s t u v a b. (JoinKinds k l m, AppendIndices is js ks) => Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b infixl 9 Source #

Compose two optics of compatible flavours.

Returns an optic of the appropriate supertype. If either or both optics are indexed, the composition preserves all the indices.

(%%) :: forall k is js ks s t u v a b. AppendIndices is js ks => Optic k is s t u v -> Optic k js u v a b -> Optic k ks s t a b infixl 9 Source #

Compose two optics of the same flavour.

Normally you can simply use (%) instead, but this may be useful to help type inference if the type of one of the optics is otherwise under-constrained.

(%&) :: Optic k is s t a b -> (Optic k is s t a b -> Optic l js s' t' a' b') -> Optic l js s' t' a' b' infixl 9 Source #

Flipped function application, specialised to optics and binding tightly.

Useful for post-composing optics transformations:

>>> toListOf (ifolded %& ifiltered (\i s -> length s <= i)) ["", "a","abc"]
["","a"]

Monoid structures

Fold-like optics admit various monoid structures (e.g. see Optics.Fold). There is no Semigroup or Monoid instance for Optic, however, because there is not a unique choice of monoid to use, and the (<>) operator could not be used to combine optics of different kinds.

Indexed optics

See the "Indexed optics" section of the overview documentation in the Optics module of the main optics package for more details on indexed optics.

type IxList = [Type] Source #

A list of index types, used for indexed optics.

Since: 0.2

type NoIx = '[] :: IxList Source #

An alias for an empty index-list

type WithIx i = '[i] :: IxList Source #

Singleton index list

class AppendIndices xs ys ks | xs ys -> ks Source #

In pseudo (dependent-)Haskell, provide a witness

foldr f (foldr f init xs) ys = foldr f init (ys ++ xs)
   where f = (->)

Since: 0.4

Minimal complete definition

appendIndices

Instances

Instances details
AppendIndices xs ('[] :: [Type]) xs Source #

If the second list is empty, we can shortcircuit and pick the first list immediately.

Instance details

Defined in Optics.Internal.Optic.TypeLevel

Methods

appendIndices :: IxEq i (Curry xs (Curry '[] i)) (Curry xs i) Source #

AppendIndices ('[] :: [Type]) ys ys Source # 
Instance details

Defined in Optics.Internal.Optic.TypeLevel

Methods

appendIndices :: IxEq i (Curry '[] (Curry ys i)) (Curry ys i) Source #

AppendIndices xs ys ks => AppendIndices (x ': xs) ys (x ': ks) Source # 
Instance details

Defined in Optics.Internal.Optic.TypeLevel

Methods

appendIndices :: IxEq i (Curry (x ': xs) (Curry ys i)) (Curry (x ': ks) i) Source #

class NonEmptyIndices (is :: IxList) Source #

Check whether a list of indices is not empty and generate sensible error message if it's not.

Instances

Instances details
(TypeError ('Text "Indexed optic is expected") :: Constraint) => NonEmptyIndices ('[] :: [Type]) Source # 
Instance details

Defined in Optics.Internal.Indexed

NonEmptyIndices (x ': xs) Source # 
Instance details

Defined in Optics.Internal.Indexed

class is ~ '[i] => HasSingleIndex (is :: IxList) (i :: Type) Source #

Generate sensible error messages in case a user tries to pass either an unindexed optic or indexed optic with unflattened indices where indexed optic with a single index is expected.

Instances

Instances details
(TypeError ('Text "Indexed optic is expected") :: Constraint, ('[] :: [Type]) ~ '[i]) => HasSingleIndex ('[] :: [Type]) i Source # 
Instance details

Defined in Optics.Internal.Indexed

(TypeError ('Text "Use icomposeN to flatten indices of type " :<>: ShowTypes is) :: Constraint, is ~ (i1 ': (i2 ': (i3 ': (i4 ': (i5 ': (i6 ': is')))))), is ~ '[i]) => HasSingleIndex (i1 ': (i2 ': (i3 ': (i4 ': (i5 ': (i6 ': is')))))) i Source # 
Instance details

Defined in Optics.Internal.Indexed

(TypeError ('Text "Use icompose5 to flatten indices of type " :<>: ShowTypes is) :: Constraint, is ~ '[i1, i2, i3, i4, i5], is ~ '[i]) => HasSingleIndex '[i1, i2, i3, i4, i5] i Source # 
Instance details

Defined in Optics.Internal.Indexed

(TypeError ('Text "Use icompose4 to combine indices of type " :<>: ShowTypes is) :: Constraint, is ~ '[i1, i2, i3, i4], is ~ '[i]) => HasSingleIndex '[i1, i2, i3, i4] i Source # 
Instance details

Defined in Optics.Internal.Indexed

(TypeError ('Text "Use icompose3 to combine indices of type " :<>: ShowTypes is) :: Constraint, is ~ '[i1, i2, i3], is ~ '[i]) => HasSingleIndex '[i1, i2, i3] i Source # 
Instance details

Defined in Optics.Internal.Indexed

(TypeError ('Text "Use (<%>) or icompose to combine indices of type " :<>: ShowTypes is) :: Constraint, is ~ '[i1, i2], is ~ '[i]) => HasSingleIndex '[i1, i2] i Source # 
Instance details

Defined in Optics.Internal.Indexed

HasSingleIndex '[i] i Source # 
Instance details

Defined in Optics.Internal.Indexed

class is ~ NoIx => AcceptsEmptyIndices (f :: Symbol) (is :: IxList) Source #

Show useful error message when a function expects optics without indices.

Instances

Instances details
AcceptsEmptyIndices f ('[] :: [Type]) Source # 
Instance details

Defined in Optics.Internal.Indexed

(TypeError (('Text "\8216" :<>: 'Text f) :<>: 'Text "\8217 accepts only optics with no indices") :: Constraint, (x ': xs) ~ NoIx) => AcceptsEmptyIndices f (x ': xs) Source # 
Instance details

Defined in Optics.Internal.Indexed

type family Curry (xs :: IxList) (y :: Type) :: Type where ... Source #

Curry a type-level list.

In pseudo (dependent-)Haskell:

Curry xs y = foldr (->) y xs

Equations

Curry '[] y = y 
Curry (x ': xs) y = x -> Curry xs y 

class CurryCompose xs where Source #

Class that is inhabited by all type-level lists xs, providing the ability to compose a function under Curry xs.

Methods

composeN :: (i -> j) -> Curry xs i -> Curry xs j Source #

Compose a function under Curry xs. This generalises (.) (aka fmap for (->)) to work for curried functions with one argument for each type in the list.

Instances

Instances details
CurryCompose ('[] :: [Type]) Source # 
Instance details

Defined in Optics.Internal.Optic.TypeLevel

Methods

composeN :: (i -> j) -> Curry '[] i -> Curry '[] j Source #

CurryCompose xs => CurryCompose (x ': xs) Source # 
Instance details

Defined in Optics.Internal.Optic.TypeLevel

Methods

composeN :: (i -> j) -> Curry (x ': xs) i -> Curry (x ': xs) j Source #

Base re-exports

(&) :: a -> (a -> b) -> b infixl 1 #

& is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator $, which allows & to be nested in $.

>>> 5 & (+1) & show
"6"

Since: base-4.8.0.0

(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 #

Flipped version of <$>.

(<&>) = flip fmap

Examples

Expand

Apply (+1) to a list, a Just and a Right:

>>> Just 2 <&> (+1)
Just 3
>>> [1,2,3] <&> (+1)
[2,3,4]
>>> Right 3 <&> (+1)
Right 4

Since: base-4.11.0.0