-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An XPath-generating embedded domain specific language. -- -- An XPath-generating embedded domain specific language, allowing -- construction and composition of type-safe XPaths in Haskell. @package HaXPath @version 0.3.0.1 -- | The core module of the XPath-generating DSL. This module should be -- used as a qualified import. module HaXPath -- | Class of types which can be used to form a valid XPath expression. -- Library users should not create instances of this class. class IsExpression a -- | Type family which associates an expression type with the type that -- will be returned by show' when it is dislayed in XPath syntax. -- This allows flexiblity to use different string-like types, such as -- String, Text, ByteString or even builders for -- these types. type family Showed p -- | XPath boolean data type, which can be showed as the string type -- s. data Bool' s -- | Bool' specialised so it can be shown as String. type Bool = Bool' String -- | XPath false() value. false :: IsString s => Bool' s -- | XPath true() value. true :: IsString s => Bool' s -- | XPath numeric data type, which can be showed as the string type -- s. data Number' s -- | Number' specialised so it can be shown as String. type Number = Number' String -- | XPath textual (string) data type, which can be showed as the string -- type s. data Text' s -- | Text' specialised so it can be shown as String. type Text = Text' String -- | The XPath text() function. text :: IsString s => Text' s -- | An XPath node which can be showed as the string type s. data Node' s -- | Node' specialised so it can be shown as String. type Node = Node' String -- | The XPath node() function. node :: IsString s => Node' s -- | Create a node with the given name. namedNode :: IsString s => s -> Node' s -- | Type to represent the root of the document. Useful in forming an -- XPaths which must begin from the root. data DocumentRoot' s -- | 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. root' :: DocumentRoot' s -- | DocumentRoot' specialised so it can be used in paths to be -- shown as String. type DocumentRoot = DocumentRoot' String -- | Specialisation of root' so it can be used in paths to be shown -- as String. root :: DocumentRoot -- | Access the value of a node's attribute in text form (equivalent to -- XPath's @). at :: s -> Text' s -- | The XPath not(.) function. not :: IsString s => Bool' s -> Bool' s -- | The XPath and operator. (&&.) :: IsString s => Bool' s -> Bool' s -> Bool' s infixr 3 &&. -- | The XPath or operator. (||.) :: IsString s => Bool' s -> Bool' s -> Bool' s infixr 2 ||. -- | The XPath contains() function. contains :: IsString s => Text' s -> Text' s -> Bool' s -- | The opposite of contains. doesNotContain :: IsString s => Text' s -> Text' s -> Bool' s -- | Type class of XPath types that can be compared for equality. Library -- users should not create instances of this class. class IsExpression t => Eq t -- | The XPath = operator. (=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 =. -- | The XPath != operator. (/=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 /=. -- | Type class of XPath types that can be ordered. Library users should -- not create instances of this class. class Eq t => Ord t -- | The XPath < operator. (<.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 <. -- | The XPath <= operator. (<=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 <=. -- | The XPath > operator. (>.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 >. -- | The XPath >= operator. (>=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 >=. -- | The XPath position() function. position :: IsString s => Number' s -- | Type to indicate the XPath begins from the current context. data CurrentContext -- | Type to indicate the XPath begins from the document root. data RootContext -- | Class of valid types for the type parameter c in -- Path'. Library users should not create instances of this class. class IsContext c -- | Type family which allows a context to be inferred. This allows for -- support of abbreviated syntax. type family Context p -- | An XPath beginning from some context c (either the root -- context or the current context). data Path' c s -- | Path' specialised so it can be shown as String. type Path c = Path' c String -- | An XPath beginning from the document root. type AbsolutePath' = Path' RootContext -- | AbsolutePath' specialised so it can be shown as String. type AbsolutePath = AbsolutePath' String -- | An XPath relative to the current context. type RelativePath' = Path' CurrentContext -- | RelativePath' specialised so it can be shown as String. type RelativePath = RelativePath' String -- | Constraint for path-like types - i.e. either a Path' or -- otherwise a type that can be converted to one using abbreviated syntax -- rules. type PathLike p = IsContext (Context p) -- | Display an XPath expression. This is useful to sending the XPath -- expression to a separate XPath evaluator e.g. a web browser. show' :: (PathLike p, IsExpression p, Monoid (Showed p), IsString (Showed p), Show (Showed p)) => p -> Showed p -- | Specialisation of show' to only generate Strings. show :: (PathLike p, IsExpression p, Showed p ~ String) => p -> String -- | The XPath ancestor:: axis. ancestor :: Node' s -> Path' CurrentContext s -- | The XPath child:: axis. child :: Node' s -> Path' CurrentContext s -- | The XPath descendant:: axis. descendant :: Node' s -> Path' CurrentContext s -- | The XPath descendant-or-self:: axis. descendantOrSelf :: Node' s -> Path' CurrentContext s -- | The XPath following:: axis. following :: Node' s -> Path' CurrentContext s -- | The XPath following-sibling:: axis. followingSibling :: Node' s -> Path' CurrentContext s -- | The XPath parent:: axis. parent :: Node' s -> Path' CurrentContext s -- | The XPath self:: axis. self :: Node' s -> Path' CurrentContext s -- | 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. class (PathLike p, PathLike q, Showed p ~ Showed q) => SlashOperator p q -- | The XPath / operator. (/.) :: SlashOperator p q => p -> q -> Path' (Context p) (Showed q) infixl 8 /. -- | 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. class (PathLike p, PathLike q, Showed p ~ Showed q) => DoubleSlashOperator p q -- | The XPath // operator. (//.) :: DoubleSlashOperator p q => p -> q -> Path' (Context p) (Showed q) infixl 8 //. -- | Type class to allow filtering of node sets. Library users should not -- create instances of this class. class (IsExpression p, PathLike p) => Filterable p -- | Filter the nodes returned by p such that they match the list -- of predicates. (#) :: (Filterable p, Showed p ~ s) => p -> [Bool' s] -> p infixl 9 # -- | The XPath count() function. count :: (IsContext c, IsString s) => Path' c s -> Number' s -- | The union of two node-sets. (|.) :: (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) infix 7 |. instance GHC.Classes.Eq HaXPath.PathBegin instance HaXPath.IsContext c => HaXPath.Filterable (HaXPath.Path' c s) instance HaXPath.Filterable (HaXPath.Node' s) instance (HaXPath.IsContext c, Data.String.IsString s) => HaXPath.DoubleSlashOperator (HaXPath.Path' c s) (HaXPath.Path' HaXPath.CurrentContext s) instance (HaXPath.IsContext c, Data.String.IsString s) => HaXPath.DoubleSlashOperator (HaXPath.Path' c s) (HaXPath.Node' s) instance Data.String.IsString s => HaXPath.DoubleSlashOperator (HaXPath.Node' s) (HaXPath.Path' HaXPath.CurrentContext s) instance Data.String.IsString s => HaXPath.DoubleSlashOperator (HaXPath.Node' s) (HaXPath.Node' s) instance Data.String.IsString s => HaXPath.DoubleSlashOperator (HaXPath.DocumentRoot' s) (HaXPath.Path' HaXPath.CurrentContext s) instance Data.String.IsString s => HaXPath.DoubleSlashOperator (HaXPath.DocumentRoot' s) (HaXPath.Node' s) instance HaXPath.IsContext c => HaXPath.SlashOperator (HaXPath.Path' c s) (HaXPath.Path' HaXPath.CurrentContext s) instance HaXPath.IsContext c => HaXPath.SlashOperator (HaXPath.Path' c s) (HaXPath.Node' s) instance HaXPath.SlashOperator (HaXPath.Node' s) (HaXPath.Path' HaXPath.CurrentContext s) instance HaXPath.SlashOperator (HaXPath.Node' s) (HaXPath.Node' s) instance HaXPath.SlashOperator (HaXPath.DocumentRoot' s) (HaXPath.Path' HaXPath.CurrentContext s) instance HaXPath.SlashOperator (HaXPath.DocumentRoot' s) (HaXPath.Node' s) instance HaXPath.Ord (HaXPath.Text' s) instance HaXPath.Ord (HaXPath.Number' s) instance HaXPath.Ord (HaXPath.Bool' s) instance HaXPath.Eq (HaXPath.Text' s) instance HaXPath.Eq (HaXPath.Number' s) instance HaXPath.Eq (HaXPath.Bool' s) instance HaXPath.IsExpression (HaXPath.Text' s) instance HaXPath.IsExpression (HaXPath.Number' s) instance HaXPath.IsExpression (HaXPath.Bool' s) instance HaXPath.IsExpression (HaXPath.Node' s) instance HaXPath.IsContext c => HaXPath.IsExpression (HaXPath.Path' c s) instance HaXPath.IsContext HaXPath.RootContext instance HaXPath.IsContext HaXPath.CurrentContext instance Data.String.IsString s => Data.String.IsString (HaXPath.Text' s) instance Data.String.IsString s => GHC.Num.Num (HaXPath.Number' s) -- | XPath operators which are re-exported from the HaXPath module -- for convenience. This module is designed to be imported unqualified. module HaXPath.Operators -- | Filter the nodes returned by p such that they match the list -- of predicates. (#) :: (Filterable p, Showed p ~ s) => p -> [Bool' s] -> p infixl 9 # -- | The XPath and operator. (&&.) :: IsString s => Bool' s -> Bool' s -> Bool' s infixr 3 &&. -- | The XPath / operator. (/.) :: SlashOperator p q => p -> q -> Path' (Context p) (Showed q) infixl 8 /. -- | The XPath // operator. (//.) :: DoubleSlashOperator p q => p -> q -> Path' (Context p) (Showed q) infixl 8 //. -- | The XPath != operator. (/=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 /=. -- | The XPath < operator. (<.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 <. -- | The XPath <= operator. (<=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 <=. -- | The XPath = operator. (=.) :: (Eq a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 =. -- | The XPath > operator. (>.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 >. -- | The XPath >= operator. (>=.) :: (Ord a, IsString (Showed a)) => a -> a -> Bool' (Showed a) infix 4 >=. -- | The XPath or operator. (||.) :: IsString s => Bool' s -> Bool' s -> Bool' s infixr 2 ||. -- | The union of two node-sets. (|.) :: (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) infix 7 |. -- | Wrapper over the HaXPath module which supports stronger type -- gurantuees such that XPaths must be valid with respect to the document -- schema. This module should be used as a qualified import. module HaXPath.Schematic -- | Type class for conversion from a schematic value to its underlying, -- non-schematic version. class ToNonSchematic t where { -- | Corresponding non-schematic type. type NonSchematic t; } -- | Convert from the schematic to the non-schematic version. toNonSchematic :: ToNonSchematic t => t -> NonSchematic t -- | The type of boolean expressions which depend on the value of the -- attribute(s) as and can be showed as the string type -- s. data Bool' (as :: [Type]) s -- | Bool' specialised so it can be shown as String. type Bool as = Bool' as String -- | XPath false() value. false :: IsString s => Bool' as s -- | XPath true() value. true :: IsString s => Bool' as s -- | The type of simple numeric expressions which depend on the value of -- the attribute(s) as and can be showed as the string type -- s. data Number' (as :: [Type]) s -- | Number' specialised so it can be shown as String type Number as = Number' as String -- | The type of simple text expressions which depend on the value of the -- attribute(s) as and can be showed as the string type -- s. data Text' (as :: [Type]) s -- | Text' specialised so it can be shown as String type Text as = Text' as String -- | The XPath text() function. text :: forall (as :: [Type]) s. IsString s => Text' as s -- | Type of an XPath node of type n which can be showed as the -- string type s. data Node' (n :: Type) s -- | Node' specialised so it can be shown as String. type Node n = Node' n String -- | Type class of node types. class IsNode n -- | Return the name of the node. nodeName :: (IsNode n, IsString s) => proxy n -> s -- | Create a node expression of the given type. namedNode :: forall n s. (IsNode n, IsString s) => Node' n s -- | Type of the document root for the schema sc which can be -- showed as the string type s. Useful in forming an XPaths -- which must begin from the root. data DocumentRoot' sc s -- | The root of the document for the schema s. root' :: DocumentRoot' sc s -- | DocumentRoot' specialised so it can be shown as String. type DocumentRoot sc = DocumentRoot' sc String -- | root' specialised so it can be shown as String. root :: DocumentRoot sc -- | Type family which contrains the possible attributes a node of type -- n may have. type family Attributes n :: [Type] -- | Type family which returns the node attribute(s) used within a given -- expression. type family AttributesUsed t -- | Type class for node attributes. class IsAttribute a -- | Return the name of the attribute. attributeName :: (IsAttribute a, IsString s) => proxy a -> s -- | Access the value of the attribute a of a node (equivalent to -- XPath's @). at :: (IsAttribute a, Member a as, IsString s) => proxy a -> Text' as s -- | The XPath not() function. not :: IsString s => Bool' as s -> Bool' as s -- | The XPath and operator. (&&.) :: IsString s => Bool' as s -> Bool' as s -> Bool' as s infixr 3 &&. -- | The XPath or operator. (||.) :: IsString s => Bool' as s -> Bool' as s -> Bool' as s infixr 2 ||. -- | The XPath = operator. (=.) :: (ToNonSchematic t, Eq (NonSchematic t), IsString (Showed (NonSchematic t))) => t -> t -> Bool' (AttributesUsed t) (Showed (NonSchematic t)) infix 4 =. -- | The XPath != operator. (/=.) :: (ToNonSchematic t, Eq (NonSchematic t), IsString (Showed (NonSchematic t))) => t -> t -> Bool' (AttributesUsed t) (Showed (NonSchematic t)) infix 4 /=. -- | The XPath < operator. (<.) :: (ToNonSchematic t, Ord (NonSchematic t), IsString (Showed (NonSchematic t))) => t -> t -> Bool' (AttributesUsed t) (Showed (NonSchematic t)) infix 4 <. -- | The XPath <= operator. (<=.) :: (ToNonSchematic t, Ord (NonSchematic t), IsString (Showed (NonSchematic t))) => t -> t -> Bool' (AttributesUsed t) (Showed (NonSchematic t)) infix 4 <=. -- | The XPath > operator. (>.) :: (ToNonSchematic t, Ord (NonSchematic t), IsString (Showed (NonSchematic t))) => t -> t -> Bool' (AttributesUsed t) (Showed (NonSchematic t)) infix 4 >. -- | The XPath >= operator. (>=.) :: (ToNonSchematic t, Ord (NonSchematic t), IsString (Showed (NonSchematic t))) => t -> t -> Bool' (AttributesUsed t) (Showed (NonSchematic t)) infix 4 >=. -- | The XPath contains() function. contains :: IsString s => Text' as s -> Text' as s -> Bool' as s -- | The opposite of contains. doesNotContain :: IsString s => Text' as s -> Text' as s -> Bool' as s -- | The XPath position() function. position :: IsString s => Number' as s -- | The type of path expressions which can be showed as the string type -- s and are formed by these steps: -- --