lens-5: Lenses, Folds and Traversals
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Lens.Profunctor

Description

This module provides conversion functions between the optics defined in this library and Profunctor-based optics.

The goal of these functions is to provide an interoperability layer between the two styles of optics, and not to reimplement all the library in terms of Profunctor optics.

Synopsis

Profunctor optic

type OpticP p s t a b = p a b -> p s t Source #

Profunctor optic.

Conversion from Van Laarhoven optics

fromLens :: Strong p => LensLike (Context a b) s t a b -> OpticP p s t a b Source #

Converts a Lens to a Profunctor-based one.

fromLens :: Lens s t a b -> LensP s t a b

fromIso :: Profunctor p => Optic p Identity s t a b -> OpticP p s t a b Source #

Converts a Iso to a Profunctor-based one.

fromIso :: Iso s t a b -> IsoP s t a b

fromPrism :: Choice p => Optic p Identity s t a b -> OpticP p s t a b Source #

Converts a Prism to a Profunctor-based one.

fromPrism :: Prism s t a b -> PrismP s t a b

fromSetter :: Mapping p => ASetter s t a b -> OpticP p s t a b Source #

Converts a Setter to a Profunctor-based one.

fromSetter :: Setter s t a b -> SetterP s t a b

fromTraversal :: Traversing p => ATraversal s t a b -> OpticP p s t a b Source #

Converts a Traversal to a Profunctor-based one.

fromTraversal :: Traversal s t a b -> TraversalP s t a b

Conversion to Van Laarhoven optics

toLens :: Functor f => OpticP (Star f) s t a b -> LensLike f s t a b Source #

Obtain a Lens from a Profunctor-based one.

toLens :: LensP s t a b -> Lens s t a b

toIso :: (Profunctor p, Functor f) => OpticP (WrappedPafb f p) s t a b -> Optic p f s t a b Source #

Obtain a Iso from a Profunctor-based one.

toIso :: IsoP s t a b -> Iso s t a b

toPrism :: (Choice p, Applicative f) => OpticP (WrappedPafb f p) s t a b -> Optic p f s t a b Source #

Obtain a Prism from a Profunctor-based one.

toPrism :: PrismP s t a b -> Prism s t a b

toSetter :: Settable f => OpticP (Star f) s t a b -> LensLike f s t a b Source #

Obtain a Setter from a Profunctor-based one.

toSetter :: SetterP s t a b -> Setter s t a b

toTraversal :: Applicative f => OpticP (Star f) s t a b -> LensLike f s t a b Source #

Obtain a Traversal from a Profunctor-based one.

toTraversal :: TraversalP s t a b -> Traversal s t a b