pontarius-xmpp-0.4.0.2: An XMPP client library

Safe HaskellNone
LanguageHaskell98

Network.Xmpp.Lens

Contents

Description

Van Laarhoven lenses for XMPP types. The lenses are designed to work with the lens library. This module also provides a few simple accessors (view, modify, set and getAll) so you don't need to pull in the lens 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)

Synopsis

Documentation

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

Van-Laarhoven lenses.

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

Accessors

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

Lenses

view :: Lens a b -> a -> b Source

Read the value the lens is pointing to

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

modify the Value(s) a Lens or Traversal is pointing to

set :: Lens a b -> b -> a -> a Source

Replace the value the lens is pointing to

Traversals

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

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

Lenses

Stanzas

class IsStanza s where Source

Methods

from :: Lens s (Maybe Jid) Source

From-attribute of the stanza

to :: Lens s (Maybe Jid) Source

To-attribute of the stanza

lang :: Lens s (Maybe LangTag) Source

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.

payloadT :: Traversal s Element Source

Traversal over the payload elements.

class HasStanzaPayload s p | s -> p where Source

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

StanzaError

StreamConfiguration

SessionConfiguration

IM

Roster

Roster

Item

QueryItem

qiAskL :: Lens QueryItem Bool Source

qiJidL :: Lens QueryItem Jid Source

qiNameL :: Lens QueryItem (Maybe Text) Source

qiGroupsL :: Lens QueryItem [Text] Source

Query

queryItemsL :: Lens Query [QueryItem] Source

IM Message

MessageBody

MessageThread

MessageSubject

InstantMessage

IMPresence