Safe Haskell | None |
---|---|
Language | Haskell2010 |
(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'
- Prism generally start with an underscore
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
- type Lens a b = forall f. Functor f => (b -> f b) -> a -> f a
- type Traversal a b = forall f. Applicative f => (b -> f b) -> a -> f a
- type Prism a b = forall p f. (Choice p, Applicative f) => p b (f b) -> p a (f a)
- type Iso a b = forall p f. (Profunctor p, Functor f) => p b (f b) -> p a (f a)
- view :: FoldLike b a a' b b' -> a -> b
- modify :: Traversal a b -> (b -> b) -> a -> a
- set :: Setter a a' b b' -> b' -> a -> a'
- getAll :: Traversal a b -> a -> [b]
- prism' :: (b -> s) -> (s -> Maybe b) -> Prism s b
- mkLens :: (a -> b) -> (b -> a -> a) -> Lens a b
- mkIso :: (a -> b) -> (b -> a) -> Iso a b
- _JidText :: Prism Text Jid
- _isFull :: Prism Jid Jid
- _isBare :: Prism Jid Jid
- _Stanza :: Prism XmppElement Stanza
- _Nonza :: Prism XmppElement Element
- _IQRequest :: Prism Stanza IQRequest
- _IQResult :: Prism Stanza IQResult
- _IQError :: Prism Stanza IQError
- _Message :: Prism Stanza Message
- _MessageError :: Prism Stanza MessageError
- _Presence :: Prism Stanza Presence
- _PresenceError :: Prism Stanza PresenceError
- class IsStanza s where
- class HasStanzaPayload s p | s -> p where
- class IsErrorStanza s where
- stanzaError :: Lens s StanzaError
- messageTypeL :: Lens Message MessageType
- presenceTypeL :: Lens Presence PresenceType
- iqRequestTypeL :: Lens IQRequest IQRequestType
- stanzaErrorTypeL :: Lens StanzaError StanzaErrorType
- stanzaErrorConditionL :: Lens StanzaError StanzaErrorCondition
- stanzaErrorTextL :: Lens StanzaError (Maybe (Maybe LangTag, NonemptyText))
- stanzaErrorApplL :: Lens StanzaError (Maybe Element)
- featureTlsL :: Lens StreamFeatures (Maybe Bool)
- featureMechanismsL :: Lens StreamFeatures [Text]
- featureRosterVerL :: Lens StreamFeatures (Maybe Bool)
- featurePreApprovalL :: Lens StreamFeatures Bool
- featuresOtherL :: Lens StreamFeatures [Element]
- preferredLangL :: Lens StreamConfiguration (Maybe LangTag)
- toJidL :: Lens StreamConfiguration (Maybe (Jid, Bool))
- connectionDetailsL :: Lens StreamConfiguration ConnectionDetails
- resolvConfL :: Lens StreamConfiguration ResolvConf
- tlsBehaviourL :: Lens StreamConfiguration TlsBehaviour
- tlsParamsL :: Lens StreamConfiguration ClientParams
- clientServerIdentificationL :: Lens ClientParams (String, ByteString)
- tlsServerIdentificationL :: Lens SessionConfiguration (String, ByteString)
- clientSupportedL :: Lens ClientParams Supported
- supportedCiphersL :: Lens Supported [Cipher]
- supportedVersionsL :: Lens Supported [Version]
- tlsSupportedCiphersL :: Lens SessionConfiguration [Cipher]
- tlsSupportedVersionsL :: Lens SessionConfiguration [Version]
- clientUseServerNameIndicationL :: Lens ClientParams Bool
- tlsUseNameIndicationL :: Lens SessionConfiguration Bool
- streamConfigurationL :: Lens SessionConfiguration StreamConfiguration
- onConnectionClosedL :: Lens SessionConfiguration (Session -> XmppFailure -> IO ())
- sessionStanzaIDsL :: Lens SessionConfiguration (IO (IO Text))
- ensableRosterL :: Lens SessionConfiguration Bool
- onRosterPushL :: Lens SessionConfiguration (Maybe RosterPushCallback)
- pluginsL :: Lens SessionConfiguration [Plugin]
- onPresenceChangeL :: Lens SessionConfiguration (Maybe (Jid -> PeerStatus -> PeerStatus -> IO ()))
- verL :: Lens Roster (Maybe Text)
- itemsL :: Lens Roster (Map Jid Item)
- riApprovedL :: Lens Item Bool
- riAskL :: Lens Item Bool
- riJidL :: Lens Item Jid
- riNameL :: Lens Item (Maybe Text)
- riSubscriptionL :: Lens Item Subscription
- riGroupsL :: Lens Item [Text]
- qiApprovedL :: Lens QueryItem (Maybe Bool)
- qiAskL :: Lens QueryItem Bool
- qiJidL :: Lens QueryItem Jid
- qiNameL :: Lens QueryItem (Maybe Text)
- qiSubscriptionL :: Lens QueryItem (Maybe Subscription)
- qiGroupsL :: Lens QueryItem [Text]
- queryVerL :: Lens Query (Maybe Text)
- queryItemsL :: Lens Query [QueryItem]
- bodyLangL :: Lens MessageBody (Maybe LangTag)
- bodyContentL :: Lens MessageBody Text
- threadIdL :: Lens MessageThread Text
- threadParentL :: Lens MessageThread (Maybe Text)
- subjectLangL :: Lens MessageSubject (Maybe LangTag)
- subjectContentL :: Lens MessageSubject Text
- imThreadL :: Lens InstantMessage (Maybe MessageThread)
- imSubjectL :: Lens InstantMessage [MessageSubject]
- imBodyL :: Lens InstantMessage [MessageBody]
- showStatusL :: Lens IMPresence (Maybe ShowStatus)
- statusL :: Lens IMPresence (Maybe Text)
- priorityL :: Lens IMPresence (Maybe Int)
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.
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
Lenses
JID
Stanzas and Nonzas
class IsStanza s where Source #
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 #
Instances
class IsErrorStanza s where Source #
stanzaError :: Lens s StanzaError Source #
Error element of the stanza
Instances
IsErrorStanza PresenceError Source # | |
Defined in Network.Xmpp.Lens | |
IsErrorStanza MessageError Source # | |
Defined in Network.Xmpp.Lens | |
IsErrorStanza IQError Source # | |
Defined in Network.Xmpp.Lens |
StanzaError
Stream
Stream Features
StreamConfiguration
TLS parameters
tlsServerIdentificationL :: Lens SessionConfiguration (String, ByteString) Source #
Access clientServerIdentification inside tlsParams inside streamConfiguration
tlsSupportedCiphersL :: Lens SessionConfiguration [Cipher] Source #
Access supportedCiphers inside clientSupported inside tlsParams
tlsSupportedVersionsL :: Lens SessionConfiguration [Version] Source #
Access supportedVersions inside clientSupported inside tlsParams
tlsUseNameIndicationL :: Lens SessionConfiguration Bool Source #
Access clientUseServerNameIndication inside tlsParams
SessionConfiguration
onConnectionClosedL :: Lens SessionConfiguration (Session -> XmppFailure -> IO ()) Source #
sessionStanzaIDsL :: Lens SessionConfiguration (IO (IO Text)) Source #
onPresenceChangeL :: Lens SessionConfiguration (Maybe (Jid -> PeerStatus -> PeerStatus -> IO ())) Source #