Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Util.Lens

Contents

Description

Re-export a minimal version of the fclabels API.

I'd like to be able to write (a = y) without parentheses, but since (.) already binds the strongest at 9, I can't make (#=) stronger. Besides, I already want (y #= 1+2@. I would need a version of (.) at 0, but that's too much trouble.

Synopsis

Documentation

type Lens a b = a :-> b Source #

lens #

Arguments

:: (f -> a)

Getter.

-> ((a -> a) -> f -> f)

Modifier.

-> (:->) f a 

Create a total lens from a getter and a modifier.

We expect the following law to hold:

get l (modify l m f) == m (get l f)

(#) :: Lens a b -> Lens b c -> Lens a c infixr 9 Source #

Compose lenses.

operators

(#$) :: Lens f a -> f -> a infixr 1 Source #

Get: bval = a record

(#=) :: Lens f a -> a -> f -> f infix 1 Source #

Set: a= 42 record

(%=) :: Lens f a -> (a -> a) -> f -> f infix 1 Source #

Modify: a#b %= (+1) record

(<#>) :: Functor f => Lens a b -> f a -> f b infixl 4 Source #

Use like a> State.get.

data

map :: Ord k => k -> Lens (Map k a) (Maybe a) Source #

set :: Ord k => k -> Lens (Set k) Bool Source #

list :: Int -> Lens [a] (Maybe a) Source #

A negative index counts from the end of the list, and a too-high index will be ignored.