pontarius-xmpp-0.5.4: An XMPP client library

Network.Xmpp.Lens

Description

(More than just) Van Laarhoven lenses for XMPP types. The accessors in here are designed to work with an optics library like lens or lens-family. This module also provides a few simple functions (view, modify, set and getAll) so you don't need to pull in another library to get some use out of them.

• The name of the lenses corresponds to the field name of the data types with an upper-case L appended. For documentation of the fields refer to the documentation of the data types (linked in the section header)
• Same goes for Traversals, except they are suffixed with a 'T'

NB you do not need to import this module to get access to the optics defined herein. They are also exported from Network.Xmpp. You only need to import this module if you want to use the complementary accessor functions without using an optics library like lens or lens-family

Synopsis

# Documentation

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

Deprecated: Use Lens' from lens-family or lens

Van-Laarhoven lenses.

type Traversal a b = forall f. Applicative f => (b -> f b) -> a -> f a Source #

Deprecated: Use Traversal' from lens-family or lens

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

type Iso a b = forall p f. (Profunctor p, Functor f) => p b (f b) -> p a (f a) Source #

# Accessors

Reimplementation of the basic lens functions so you don't have to bring in a lens library to use the optics

## Lenses

view :: FoldLike b a a' b b' -> a -> b #

view :: Getter a a' b b' -> a -> b


Demote a lens or getter to a projection function.

view :: Monoid b => Fold a a' b b' -> a -> b


Returns the monoidal summary of a traversal or a fold.

modify :: Traversal a b -> (b -> b) -> a -> a Source #

Deprecated: use over (lens-family, lens)

set :: Setter a a' b b' -> b' -> a -> a' #

Set all referenced fields to the given value.

# Traversals

getAll :: Traversal a b -> a -> [b] Source #

Deprecated: use toListOf (lens-family), partsOf (lens) or similar

Return all the values a Traversal is pointing to in a list

# Prisms

## Construction

prism' :: (b -> s) -> (s -> Maybe b) -> Prism s b Source #

mkLens :: (a -> b) -> (b -> a -> a) -> Lens a b Source #

mkIso :: (a -> b) -> (b -> a) -> Iso a b Source #

# Lenses

## Stanzas and Nonzas

class IsStanza s where Source #

Minimal complete definition

Methods

from :: Lens s (Maybe Jid) Source #

From-attribute of the stanza

to :: Lens s (Maybe Jid) Source #

To-attribute of the stanza

Langtag of the stanza

sid :: Lens s (Maybe Text) Source #

Stanza ID. Setting this to Nothing for IQ* stanzas will set the id to the empty Text.

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods

class HasStanzaPayload s p | s -> p where Source #

Minimal complete definition

Methods

payload :: Lens s p Source #

Payload element(s) of the stanza. Since the amount of elements possible in a stanza vary by type, this lens can't be used with a general Stanza. There is, however, a more general Traversable that works with all stanzas (including Stanza): payloadT

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods

class IsErrorStanza s where Source #

Minimal complete definition

stanzaError

Methods

Error element of the stanza

Instances

 Source # Methods Source # Methods Source # Methods

## Stream Features

### StreamConfiguration

#### TLS parameters

Access clientServerIdentification inside tlsParams inside streamConfiguration

Access supportedCiphers inside clientSupported inside tlsParams

Access supportedVersions inside clientSupported inside tlsParams

Access clientUseServerNameIndication inside tlsParams