Module

Data.Lens.Common

Package
profunctor-lenses
Repository
purerl/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

#second Source

second :: forall p a b c. Strong p => p b c -> p (Tuple a b) (Tuple a c)

#first Source

first :: forall p a b c. Strong p => p a b -> p (Tuple a c) (Tuple b c)

#_2 Source

_2 :: forall a b c. Lens (Tuple c a) (Tuple c b) a b

Lens for the second component of a Tuple.

#_1 Source

_1 :: forall a b c. Lens (Tuple a c) (Tuple b c) a b

Lens for the first component of a Tuple.

Re-exports from Data.Lens.Lens.Unit

#united Source

united :: forall a. Lens' a Unit

There is a Unit in everything.

Re-exports from Data.Lens.Prism.Either

#right Source

right :: forall p a b c. Choice p => p b c -> p (Either a b) (Either a c)

#left Source

left :: forall p a b c. Choice p => p a b -> p (Either a c) (Either b c)

#_Right Source

_Right :: forall a b c. Prism (Either c a) (Either c b) a b

Prism for the Right constructor of Either.

#_Left Source

_Left :: forall a b c. Prism (Either a c) (Either b c) a b

Prism for the Left constructor of Either.

Re-exports from Data.Lens.Prism.Maybe

#_Nothing Source

_Nothing :: forall a b. Prism (Maybe a) (Maybe b) Unit Unit

Prism for the Nothing constructor of Maybe.

#_Just Source

_Just :: forall a b. Prism (Maybe a) (Maybe b) a b

Prism for the Just constructor of Maybe.