Module

Data.Lens.Common

This module defines common lenses and prisms.

#simple

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

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

#first

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

#_2

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

Lens for the second component of a Tuple.

#_1

_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

united :: forall a. Lens' a Unit

There is a Unit in everything.

> view united [1,2,3]
unit
> over united (\a -> a :: Unit) [1,2,3]
[1 2 3]

Re-exports from Data.Lens.Prism.Either

#right

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

#left

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

#_Right

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

Prism for the Right constructor of Either.

#_Left

_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

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

Prism for the Nothing constructor of Maybe.

#_Just

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

Prism for the Just constructor of Maybe.

Modules