    -- | basic 'Pattern' functions
    --

    module Text.XML.HXT.RelaxNG.PatternFunctions

    where

    import Text.XML.HXT.RelaxNG.DataTypes

    -- ------------------------------------------------------------

    isRelaxEmpty :: Pattern -> Bool
    isRelaxEmpty :: Pattern -> Bool
    isRelaxEmpty Pattern
    Empty = Bool
    True
    isRelaxEmpty Pattern
    _     = Bool
    False

    isRelaxNotAllowed :: Pattern -> Bool
    isRelaxNotAllowed :: Pattern -> Bool
    isRelaxNotAllowed (NotAllowed ErrMessage
    _) = Bool
    True
    isRelaxNotAllowed Pattern
    _              = Bool
    False

    isRelaxText :: Pattern -> Bool
    isRelaxText :: Pattern -> Bool
    isRelaxText Pattern
    Text = Bool
    True
    isRelaxText Pattern
    _    = Bool
    False

    isRelaxChoice :: Pattern -> Bool
    isRelaxChoice :: Pattern -> Bool
    isRelaxChoice (Choice Pattern
    _ Pattern
    _) = Bool
    True
    isRelaxChoice Pattern
    _            = Bool
    False

    isRelaxInterleave :: Pattern -> Bool
    isRelaxInterleave :: Pattern -> Bool
    isRelaxInterleave (Interleave Pattern
    _ Pattern
    _) = Bool
    True
    isRelaxInterleave Pattern
    _                = Bool
    False

    isRelaxGroup :: Pattern -> Bool
    isRelaxGroup :: Pattern -> Bool
    isRelaxGroup (Group Pattern
    _ Pattern
    _) = Bool
    True
    isRelaxGroup Pattern
    _           = Bool
    False

    isRelaxOneOrMore :: Pattern -> Bool
    isRelaxOneOrMore :: Pattern -> Bool
    isRelaxOneOrMore (OneOrMore Pattern
    _) = Bool
    True
    isRelaxOneOrMore Pattern
    _             = Bool
    False

    isRelaxList :: Pattern -> Bool
    isRelaxList :: Pattern -> Bool
    isRelaxList (List Pattern
    _) = Bool
    True
    isRelaxList Pattern
    _        = Bool
    False

    isRelaxData :: Pattern -> Bool
    isRelaxData :: Pattern -> Bool
    isRelaxData (Data Datatype
    _ ParamList
    _) = Bool
    True
    isRelaxData Pattern
    _          = Bool
    False

    isRelaxDataExcept :: Pattern -> Bool
    isRelaxDataExcept :: Pattern -> Bool
    isRelaxDataExcept (DataExcept Datatype
    _ ParamList
    _ Pattern
    _) = Bool
    True
    isRelaxDataExcept Pattern
    _                  = Bool
    False

    isRelaxValue :: Pattern -> Bool
    isRelaxValue :: Pattern -> Bool
    isRelaxValue (Value Datatype
    _ String
    _ Context
    _) = Bool
    True
    isRelaxValue Pattern
    _             = Bool
    False

    isRelaxAttribute :: Pattern -> Bool
    isRelaxAttribute :: Pattern -> Bool
    isRelaxAttribute (Attribute NameClass
    _ Pattern
    _) = Bool
    True
    isRelaxAttribute Pattern
    _               = Bool
    False

    isRelaxElement :: Pattern -> Bool
    isRelaxElement :: Pattern -> Bool
    isRelaxElement (Element NameClass
    _ Pattern
    _) = Bool
    True
    isRelaxElement Pattern
    _             = Bool
    False

    isRelaxAfter :: Pattern -> Bool
    isRelaxAfter :: Pattern -> Bool
    isRelaxAfter (After Pattern
    _ Pattern
    _) = Bool
    True
    isRelaxAfter Pattern
    _           = Bool
    False

    -- | Returns a list of children pattern for each pattern,
    -- e.g. (Choice p1 p2) = [p1, p2]
    getChildrenPattern :: Pattern -> [Pattern]
    getChildrenPattern :: Pattern -> [Pattern]
    getChildrenPattern (Choice Pattern
    p1 Pattern
    p2) = [Pattern
    p1, Pattern
    p2]
    getChildrenPattern (Interleave Pattern
    p1 Pattern
    p2) = [Pattern
    p1, Pattern
    p2]
    getChildrenPattern (Group Pattern
    p1 Pattern
    p2) = [Pattern
    p1, Pattern
    p2]
    getChildrenPattern (OneOrMore Pattern
    p) = [Pattern
    p]
    getChildrenPattern (List Pattern
    p) = [Pattern
    p]
    getChildrenPattern (Element NameClass
    _ Pattern
    p) = [Pattern
    p]
    getChildrenPattern (DataExcept Datatype
    _ ParamList
    _ Pattern
    p) = [Pattern
    p]
    getChildrenPattern (Attribute NameClass
    _ Pattern
    p) = [Pattern
    p]
    getChildrenPattern (After Pattern
    p1 Pattern
    p2) = [Pattern
    p1, Pattern
    p2]
    getChildrenPattern Pattern
    _ = []

    -- | Returns the nameclass of a element- or attribute pattern.
    -- Otherwise 'NCError' is returned.
    getNameClassFromPattern :: Pattern -> NameClass
    getNameClassFromPattern :: Pattern -> NameClass
    getNameClassFromPattern (Element NameClass
    nc Pattern
    _) = NameClass
    nc
    getNameClassFromPattern (Attribute NameClass
    nc Pattern
    _) = NameClass
    nc
    getNameClassFromPattern Pattern
    _ = String -> NameClass
    NCError String
    "Pattern without a NameClass"

    -- | Returns a string representation of the pattern name
    getPatternName :: Pattern -> String
    getPatternName :: Pattern -> String
    getPatternName (Pattern
    Empty) = String
    "Empty"
    getPatternName (NotAllowed ErrMessage
    _) = String
    "NotAllowed"
    getPatternName (Pattern
    Text) = String
    "Text"
    getPatternName (Choice Pattern
    _ Pattern
    _) = String
    "Choice"
    getPatternName (Interleave Pattern
    _ Pattern
    _) = String
    "Interleave"
    getPatternName (Group Pattern
    _ Pattern
    _) = String
    "Group"
    getPatternName (OneOrMore Pattern
    _) = String
    "OneOrMore"
    getPatternName (List Pattern
    _) = String
    "List"
    getPatternName (Data Datatype
    _ ParamList
    _ ) = String
    "Data"
    getPatternName (DataExcept Datatype
    _ ParamList
    _ Pattern
    _) = String
    "DataExcept"
    getPatternName (Value Datatype
    _ String
    _ Context
    _) = String
    "Value"
    getPatternName (Attribute NameClass
    _ Pattern
    _) = String
    "Attribute"
    getPatternName (Element NameClass
    _ Pattern
    _) = String
    "Element"
    getPatternName (After Pattern
    _ Pattern
    _) = String
    "After"