hans-3.0.2: Network Stack

Safe HaskellSafe
LanguageHaskell2010

Hans.Lens

Contents

Synopsis

Lenses

type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t Source #

General lenses that allow for the type of the inner field to change.

type Lens' s a = Lens s s a a Source #

Lenses that don't change type.

lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b Source #

Getters

type Getting r s a = (a -> Const r a) -> s -> Const r s Source #

type Getter s a = forall r. Getting r s a Source #

view :: Getting a s a -> s -> a Source #

to :: (s -> a) -> Getting r s a Source #

Setters

type ASetter s t a b = (a -> Id b) -> s -> Id t Source #

type ASetter' s a = ASetter s s a a Source #

set :: Lens s t a b -> b -> s -> t Source #

over :: ASetter s t a b -> (a -> b) -> s -> t Source #

modify :: Lens s t a b -> (a -> (b, r)) -> s -> (t, r) Source #

Utility Lenses

bit :: Bits a => Int -> Lens' a Bool Source #

byte :: (Integral a, Bits a) => Int -> Lens' a Word8 Source #