Copyright | (c) 2013 Joseph Abrahamson |
---|---|
License | MIT |
Maintainer | me@jspha.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
A Hexpat lens module for generic tags.
Lenses provide power to do very concise XML tree diving. This module provides a less general interface to the Hexpat datatypes via lenses.
- name :: Traversal' (NodeG f tag text) tag
- attributes :: Traversal' (NodeG f tag text) (Attributes tag text)
- text :: Prism' (NodeG f tag text) text
- children :: Traversal' (NodeG f tag text) (f (NodeG f tag text))
- allNodes :: Traversable c => NodeG c tag text -> [NodeG c tag text]
- (./) :: Plated i => Traversal' s i -> Traversal' i a -> Traversal' s a
- named :: (Eq a, Applicative f, Choice p) => a -> Optic' p f (NodeG f1 a text) (NodeG f1 a text)
- parameterized :: (Eq (IxValue a), Applicative f, Choice p, Ixed a) => Index a -> IxValue a -> Optic' p f a a
Basic inspection
name :: Traversal' (NodeG f tag text) tag Source #
attributes :: Traversal' (NodeG f tag text) (Attributes tag text) Source #
text :: Prism' (NodeG f tag text) text Source #
Prismatic access to the text of a Text
node. This is more
powerful than name
, children
, and attributes
since it can
be Review
ed.
Recursive inspection
(./) :: Plated i => Traversal' s i -> Traversal' i a -> Traversal' s a infixr 9 Source #
Glue two Traversal
s together as relations. This is much like
XPath
's *slash*.
Filters
named :: (Eq a, Applicative f, Choice p) => a -> Optic' p f (NodeG f1 a text) (NodeG f1 a text) Source #
Traverses Element
s which have a particular name.
parameterized :: (Eq (IxValue a), Applicative f, Choice p, Ixed a) => Index a -> IxValue a -> Optic' p f a a Source #
parameterized k v
traverses Element
s which match the value
v
at the key k
in their attributes.
Orphan instances
Eq tag => Ixed (NodeG c tag text) Source # | |
Eq tag => At (NodeG f tag text) Source # | This forms a valid |
Traversable f => Plated (NodeG f tag text) Source # | |