irc-client-1.1.2.3: An IRC client library.
Copyright(c) 2017 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
PortabilityCPP, ImpredicativeTypes
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.IRC.Client.Internal.Lens

Description

Types and functions for dealing with optics without depending on the lens library.

This module is NOT considered to form part of the public interface of this library.

Synopsis

Internal lens synonyms

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

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

type Getter s a = forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s Source #

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

type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #

type Prism' s a = Prism s s a a Source #

Utilities

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

Get a value from a lens.

set :: Lens' s a -> a -> s -> s Source #

Set a value in a lens.

modify :: Lens' s a -> (a -> a) -> s -> s Source #

Modify a value in a lens.

preview :: Prism' s a -> s -> Maybe a Source #

Read a value from a prism.

STM

snapshot :: MonadIO m => Getting (TVar a) s (TVar a) -> s -> m a Source #

Atomically snapshot some shared state.

snapshotModify :: MonadIO m => Lens' s (TVar a) -> (a -> STM (a, b)) -> s -> m b Source #

Atomically snapshot and modify some shared state.