Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The core module of the XPath-generating DSL. This module should be used as a qualified import.
Synopsis
- class IsExpression a
- type family Showed p where ...
- data Bool' s
- type Bool = Bool' String
- false :: IsString s => Bool' s
- true :: IsString s => Bool' s
- data Number' s
- type Number = Number' String
- data Text' s
- type Text = Text' String
- text :: IsString s => Text' s
- data Node' s
- type Node = Node' String
- node :: IsString s => Node' s
- namedNode :: IsString s => s -> Node' s
- data DocumentRoot' s
- root' :: DocumentRoot' s
- type DocumentRoot = DocumentRoot' String
- root :: DocumentRoot
- at :: s -> Text' s
- not :: IsString s => Bool' s -> Bool' s
- (&&.) :: IsString s => Bool' s -> Bool' s -> Bool' s
- (||.) :: IsString s => Bool' s -> Bool' s -> Bool' s
- contains :: IsString s => Text' s -> Text' s -> Bool' s
- doesNotContain :: IsString s => Text' s -> Text' s -> Bool' s
- class IsExpression t => Eq t
- (=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a)
- (/=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a)
- class Eq t => Ord t
- (<.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a)
- (<=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a)
- (>.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a)
- (>=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a)
- position :: IsString s => Number' s
- data CurrentContext
- data RootContext
- class IsContext c
- type family Context p where ...
- data Path' c s
- type Path c = Path' c String
- type AbsolutePath' = Path' RootContext
- type AbsolutePath = AbsolutePath' String
- type RelativePath' = Path' CurrentContext
- type RelativePath = RelativePath' String
- type PathLike p = IsContext (Context p)
- show' :: (PathLike p, IsExpression p, Monoid (Showed p), IsString (Showed p), Show (Showed p)) => p -> Showed p
- show :: (PathLike p, IsExpression p, Showed p ~ String) => p -> String
- ancestor :: Node' s -> Path' CurrentContext s
- child :: Node' s -> Path' CurrentContext s
- descendant :: Node' s -> Path' CurrentContext s
- descendantOrSelf :: Node' s -> Path' CurrentContext s
- following :: Node' s -> Path' CurrentContext s
- followingSibling :: Node' s -> Path' CurrentContext s
- parent :: Node' s -> Path' CurrentContext s
- self :: Node' s -> Path' CurrentContext s
- class (PathLike p, PathLike q, Showed p ~ Showed q) => SlashOperator p q where
- class (PathLike p, PathLike q, Showed p ~ Showed q) => DoubleSlashOperator p q where
- class (IsExpression p, PathLike p) => Filterable p where
- count :: (IsContext c, IsString s) => Path' c s -> Number' s
- (|.) :: (PathLike p, PathLike q, IsExpression p, IsExpression q, Context p ~ Context q, Showed p ~ Showed q, IsString (Showed q)) => p -> q -> Path' (Context p) (Showed q)
Basic data types
class IsExpression a Source #
Class of types which can be used to form a valid XPath expression. Library users should not create instances of this class.
toExpression
Instances
IsExpression (Bool' s) Source # | |
Defined in HaXPath toExpression :: Bool' s -> Expression (Showed (Bool' s)) | |
IsExpression (Node' s) Source # | |
Defined in HaXPath toExpression :: Node' s -> Expression (Showed (Node' s)) | |
IsExpression (Number' s) Source # | |
Defined in HaXPath toExpression :: Number' s -> Expression (Showed (Number' s)) | |
IsExpression (Text' s) Source # | |
Defined in HaXPath toExpression :: Text' s -> Expression (Showed (Text' s)) | |
IsContext c => IsExpression (Path' c s) Source # | |
Defined in HaXPath toExpression :: Path' c s -> Expression (Showed (Path' c s)) |
XPath boolean data type, which can be showed as the string type s
.
XPath numeric data type, which can be showed as the string type s
.
XPath textual (string) data type, which can be showed as the string type s
.
Nodes
An XPath node which can be showed as the string type s
.
Instances
Filterable (Node' s) Source # | |
IsExpression (Node' s) Source # | |
Defined in HaXPath toExpression :: Node' s -> Expression (Showed (Node' s)) | |
IsString s => DoubleSlashOperator (DocumentRoot' s) (Node' s) Source # | |
IsString s => DoubleSlashOperator (Node' s) (Node' s) Source # | |
SlashOperator (DocumentRoot' s) (Node' s) Source # | |
SlashOperator (Node' s) (Node' s) Source # | |
IsString s => DoubleSlashOperator (Node' s) (Path' CurrentContext s) Source # | |
SlashOperator (Node' s) (Path' CurrentContext s) Source # | |
(IsContext c, IsString s) => DoubleSlashOperator (Path' c s) (Node' s) Source # | |
IsContext c => SlashOperator (Path' c s) (Node' s) Source # | |
data DocumentRoot' s Source #
Type to represent the root of the document. Useful in forming an XPaths which must begin from the root.
Instances
IsString s => DoubleSlashOperator (DocumentRoot' s) (Node' s) Source # | |
SlashOperator (DocumentRoot' s) (Node' s) Source # | |
IsString s => DoubleSlashOperator (DocumentRoot' s) (Path' CurrentContext s) Source # | |
Defined in HaXPath (//.) :: DocumentRoot' s -> Path' CurrentContext s -> Path' (Context (DocumentRoot' s)) (Showed (Path' CurrentContext s)) Source # | |
SlashOperator (DocumentRoot' s) (Path' CurrentContext s) Source # | |
Defined in HaXPath (/.) :: DocumentRoot' s -> Path' CurrentContext s -> Path' (Context (DocumentRoot' s)) (Showed (Path' CurrentContext s)) Source # |
root' :: DocumentRoot' s Source #
The root of the document. There is no corresponding XPath expression for root
but it can be used to indicate that
an XPath must be begin from the root by using this as the first step in the path.
type DocumentRoot = DocumentRoot' String Source #
DocumentRoot'
specialised so it can be used in paths to be shown as String
.
root :: DocumentRoot Source #
Access the value of a node's attribute in text form (equivalent to XPath's @
).
Basic combinators
class IsExpression t => Eq t Source #
Type class of XPath types that can be compared for equality. Library users should not create instances of this class.
(=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 Source #
The XPath =
operator.
(/=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 Source #
The XPath !=
operator.
Type class of XPath types that can be ordered. Library users should not create instances of this class.
(<.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 Source #
The XPath <
operator.
(<=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 Source #
The XPath <=
operator.
(>.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 Source #
The XPath >
operator.
(>=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 Source #
The XPath >=
operator.
Paths
data CurrentContext Source #
Type to indicate the XPath begins from the current context.
Instances
IsContext CurrentContext Source # | |
Defined in HaXPath toPathBegin :: proxy CurrentContext -> PathBegin | |
IsString s => DoubleSlashOperator (DocumentRoot' s) (Path' CurrentContext s) Source # | |
Defined in HaXPath (//.) :: DocumentRoot' s -> Path' CurrentContext s -> Path' (Context (DocumentRoot' s)) (Showed (Path' CurrentContext s)) Source # | |
IsString s => DoubleSlashOperator (Node' s) (Path' CurrentContext s) Source # | |
SlashOperator (DocumentRoot' s) (Path' CurrentContext s) Source # | |
Defined in HaXPath (/.) :: DocumentRoot' s -> Path' CurrentContext s -> Path' (Context (DocumentRoot' s)) (Showed (Path' CurrentContext s)) Source # | |
SlashOperator (Node' s) (Path' CurrentContext s) Source # | |
(IsContext c, IsString s) => DoubleSlashOperator (Path' c s) (Path' CurrentContext s) Source # | |
IsContext c => SlashOperator (Path' c s) (Path' CurrentContext s) Source # | |
data RootContext Source #
Type to indicate the XPath begins from the document root.
Instances
IsContext RootContext Source # | |
Defined in HaXPath toPathBegin :: proxy RootContext -> PathBegin |
Class of valid types for the type parameter c
in Path'
. Library users should not create instances of this
class.
toPathBegin
Instances
IsContext CurrentContext Source # | |
Defined in HaXPath toPathBegin :: proxy CurrentContext -> PathBegin | |
IsContext RootContext Source # | |
Defined in HaXPath toPathBegin :: proxy RootContext -> PathBegin |
type family Context p where ... Source #
Type family which allows a context to be inferred. This allows for support of abbreviated syntax.
Context (Path' c s) = c | |
Context (Node' s) = CurrentContext | |
Context (DocumentRoot' s) = RootContext |
An XPath beginning from some context c
(either the root context or the current context).
Instances
type AbsolutePath' = Path' RootContext Source #
An XPath beginning from the document root.
type AbsolutePath = AbsolutePath' String Source #
AbsolutePath'
specialised so it can be shown as String
.
type RelativePath' = Path' CurrentContext Source #
An XPath relative to the current context.
type RelativePath = RelativePath' String Source #
RelativePath'
specialised so it can be shown as String
.
type PathLike p = IsContext (Context p) Source #
Constraint for path-like types - i.e. either a Path'
or otherwise a type that can be converted to one using
abbreviated syntax rules.
show' :: (PathLike p, IsExpression p, Monoid (Showed p), IsString (Showed p), Show (Showed p)) => p -> Showed p Source #
Display an XPath expression. This is useful to sending the XPath expression to a separate XPath evaluator e.g. a web browser.
Axes
descendant :: Node' s -> Path' CurrentContext s Source #
The XPath descendant::
axis.
descendantOrSelf :: Node' s -> Path' CurrentContext s Source #
The XPath descendant-or-self::
axis.
followingSibling :: Node' s -> Path' CurrentContext s Source #
The XPath following-sibling::
axis.
Path combinators
class (PathLike p, PathLike q, Showed p ~ Showed q) => SlashOperator p q where Source #
Type class for the XPath /
operator. It can operate on multiple types as the axes can be inferred based on
XPath's abbreviated syntax. Library users should not create instances of this class.
Instances
SlashOperator (DocumentRoot' s) (Node' s) Source # | |
SlashOperator (Node' s) (Node' s) Source # | |
SlashOperator (DocumentRoot' s) (Path' CurrentContext s) Source # | |
Defined in HaXPath (/.) :: DocumentRoot' s -> Path' CurrentContext s -> Path' (Context (DocumentRoot' s)) (Showed (Path' CurrentContext s)) Source # | |
SlashOperator (Node' s) (Path' CurrentContext s) Source # | |
IsContext c => SlashOperator (Path' c s) (Node' s) Source # | |
IsContext c => SlashOperator (Path' c s) (Path' CurrentContext s) Source # | |
class (PathLike p, PathLike q, Showed p ~ Showed q) => DoubleSlashOperator p q where Source #
Type class for the XPath //
operator. It can operate on multiple types as the axes can be inferred based on
XPath's abbreviated syntax. Library users should not create instances of this class.
Instances
IsString s => DoubleSlashOperator (DocumentRoot' s) (Node' s) Source # | |
IsString s => DoubleSlashOperator (Node' s) (Node' s) Source # | |
IsString s => DoubleSlashOperator (DocumentRoot' s) (Path' CurrentContext s) Source # | |
Defined in HaXPath (//.) :: DocumentRoot' s -> Path' CurrentContext s -> Path' (Context (DocumentRoot' s)) (Showed (Path' CurrentContext s)) Source # | |
IsString s => DoubleSlashOperator (Node' s) (Path' CurrentContext s) Source # | |
(IsContext c, IsString s) => DoubleSlashOperator (Path' c s) (Node' s) Source # | |
(IsContext c, IsString s) => DoubleSlashOperator (Path' c s) (Path' CurrentContext s) Source # | |
class (IsExpression p, PathLike p) => Filterable p where Source #
Type class to allow filtering of node sets. Library users should not create instances of this class.