Module
Data.Lens.Common
- Package
- purescript-profunctor-lenses
- Repository
- purescript-contrib/purescript-profunctor-lenses
This module defines common lenses and prisms.
#simple Source
simple :: forall p s a. Optic' p s a -> Optic' p s a
This is useful for when you want to restrict the type of another optic. For example, suppose you have the following declarations:
newtype X = X Int
derive instance newtypeX :: Newtype X _
Attempting to view with the _Newtype
optic:
X 42 ^. _Newtype
Will result in a type error:
The inferred type
forall t3 t5. Newtype t3 t5 => Int
has type variables which are not mentioned in the body of the type.
Consider adding a type annotation.
However, if we apply the simple
function:
X 42 ^. simple _Newtype
We get the expected result 42
.
Re-exports from Data.Lens.Lens.Tuple
Re-exports from Data.Lens.Lens.Unit
Re-exports from Data.Lens.Prism.Either
Re-exports from Data.Lens.Prism.Maybe
- Modules
- Data.
Lens - Data.
Lens. AffineTraversal - Data.
Lens. At - Data.
Lens. Common - Data.
Lens. Fold - Data.
Lens. Fold. Partial - Data.
Lens. Getter - Data.
Lens. Grate - Data.
Lens. Index - Data.
Lens. Indexed - Data.
Lens. Internal. Bazaar - Data.
Lens. Internal. Exchange - Data.
Lens. Internal. Focusing - Data.
Lens. Internal. Forget - Data.
Lens. Internal. Grating - Data.
Lens. Internal. Indexed - Data.
Lens. Internal. Market - Data.
Lens. Internal. Re - Data.
Lens. Internal. Shop - Data.
Lens. Internal. Stall - Data.
Lens. Internal. Tagged - Data.
Lens. Internal. Wander - Data.
Lens. Internal. Zipping - Data.
Lens. Iso - Data.
Lens. Iso. Newtype - Data.
Lens. Lens - Data.
Lens. Lens. Product - Data.
Lens. Lens. Tuple - Data.
Lens. Lens. Unit - Data.
Lens. Lens. Void - Data.
Lens. Prism - Data.
Lens. Prism. Coproduct - Data.
Lens. Prism. Either - Data.
Lens. Prism. Maybe - Data.
Lens. Record - Data.
Lens. Setter - Data.
Lens. Traversal - Data.
Lens. Types - Data.
Lens. Zoom