| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.XML.HXT.RelaxNG.DataTypeLibUtils
Description
exports helper functions for the integration of new datatype-libraries
Synopsis
- errorMsgEqual :: DatatypeName -> String -> String -> String
- errorMsgDataTypeNotAllowed :: String -> String -> [(String, String)] -> String -> String
- errorMsgDataTypeNotAllowed0 :: String -> String -> String
- errorMsgDataTypeNotAllowed2 :: String -> String -> String -> String -> String
- errorMsgDataLibQName :: String -> String -> String -> String
- errorMsgParam :: LocalName -> String -> String -> String
- rng_length :: String
- rng_maxLength :: String
- rng_minLength :: String
- rng_maxExclusive :: String
- rng_minExclusive :: String
- rng_maxInclusive :: String
- rng_minInclusive :: String
- class ArrowZero a => ArrowPlus (a :: Type -> Type -> Type) where
- (<+>) :: a b c -> a b c -> a b c
- (>>>) :: forall {k} cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c
- (<<^) :: Arrow a => a c d -> (b -> c) -> a b d
- (>>^) :: Arrow a => a b c -> (c -> d) -> a b d
- (^<<) :: Arrow a => (c -> d) -> a b c -> a b d
- (^>>) :: Arrow a => (b -> c) -> a c d -> a b d
- leftApp :: ArrowApply a => a b c -> a (Either b d) (Either c d)
- returnA :: Arrow a => a b b
- (<<<) :: forall {k} cat (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
- class Category a => Arrow (a :: Type -> Type -> Type) where
- class Arrow a => ArrowApply (a :: Type -> Type -> Type) where
- app :: a (a b c, b) c
- class Arrow a => ArrowChoice (a :: Type -> Type -> Type) where
- class Arrow a => ArrowLoop (a :: Type -> Type -> Type) where
- loop :: a (b, d) (c, d) -> a b c
- newtype ArrowMonad (a :: Type -> Type -> Type) b = ArrowMonad (a () b)
- class Arrow a => ArrowZero (a :: Type -> Type -> Type) where
- zeroArrow :: a b c
- newtype Kleisli (m :: Type -> Type) a b = Kleisli {
- runKleisli :: a -> m b
- module Text.XML.HXT.DOM.Util
- module Text.XML.HXT.RelaxNG.Utils
- module Text.XML.HXT.RelaxNG.DataTypes
- type FunctionTable = [(String, String -> String -> Bool)]
- stringValidFT :: FunctionTable -> DatatypeName -> Integer -> Integer -> ParamList -> CheckString
- fctTableString :: FunctionTable
- fctTableList :: FunctionTable
- stringValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString
- numberValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString
- numParamValid :: (Integer -> Integer -> Bool) -> String -> String -> Bool
- data CheckA a b
- type CheckString = CheckA String String
- type CheckInteger = CheckA Integer Integer
- performCheck :: CheckA a b -> a -> Maybe String
- ok :: CheckA a a
- failure :: (a -> String) -> CheckA a b
- assert :: (a -> Bool) -> (a -> String) -> CheckA a a
- assertMaybe :: (a -> Maybe b) -> (a -> String) -> CheckA a b
- checkWith :: (a -> b) -> CheckA b c -> CheckA a a
Documentation
errorMsgEqual :: DatatypeName -> String -> String -> String Source #
errorMsgDataTypeNotAllowed :: String -> String -> [(String, String)] -> String -> String Source #
errorMsgDataTypeNotAllowed0 :: String -> String -> String Source #
errorMsgDataTypeNotAllowed2 :: String -> String -> String -> String -> String Source #
errorMsgDataLibQName :: String -> String -> String -> String Source #
errorMsgParam :: LocalName -> String -> String -> String Source #
Error Message for the equality test of two datatype values
- 1.parameter : datatype
- 2.parameter : datatype value
- 3.parameter : datatype value
example:
errorMsgEqual "Int" "21" "42" -> "Datatype Int with value = 21 expected, but value = 42 found"
rng_length :: String Source #
rng_maxLength :: String Source #
rng_minLength :: String Source #
rng_maxExclusive :: String Source #
rng_minExclusive :: String Source #
rng_maxInclusive :: String Source #
rng_minInclusive :: String Source #
class ArrowZero a => ArrowPlus (a :: Type -> Type -> Type) where #
leftApp :: ArrowApply a => a b c -> a (Either b d) (Either c d) #
class Category a => Arrow (a :: Type -> Type -> Type) where #
Methods
first :: a b c -> a (b, d) (c, d) #
second :: a b c -> a (d, b) (d, c) #
class Arrow a => ArrowApply (a :: Type -> Type -> Type) where #
Instances
| ArrowApply IOLA | |
Defined in Control.Arrow.IOListArrow | |
| ArrowApply LA | |
Defined in Control.Arrow.ListArrow | |
| Monad m => ArrowApply (Kleisli m) | |
Defined in GHC.Internal.Control.Arrow | |
| ArrowApply (IOSLA s) | |
Defined in Control.Arrow.IOStateListArrow | |
| ArrowApply (SLA s) | |
Defined in Control.Arrow.StateListArrow | |
| ArrowApply (->) | |
Defined in GHC.Internal.Control.Arrow | |
class Arrow a => ArrowChoice (a :: Type -> Type -> Type) where #
Methods
left :: a b c -> a (Either b d) (Either c d) #
right :: a b c -> a (Either d b) (Either d c) #
(+++) :: a b c -> a b' c' -> a (Either b b') (Either c c') #
Instances
| ArrowChoice IOLA | |
| ArrowChoice LA | |
| Monad m => ArrowChoice (Kleisli m) | |
Defined in GHC.Internal.Control.Arrow | |
| ArrowChoice (IOSLA s) | |
Defined in Control.Arrow.IOStateListArrow | |
| ArrowChoice (SLA s) | |
| ArrowChoice (->) | |
newtype ArrowMonad (a :: Type -> Type -> Type) b #
Constructors
| ArrowMonad (a () b) |
Instances
class Arrow a => ArrowZero (a :: Type -> Type -> Type) where #
Instances
| ArrowZero IOLA | |
Defined in Control.Arrow.IOListArrow | |
| ArrowZero LA | |
Defined in Control.Arrow.ListArrow | |
| ArrowZero CheckA Source # | |
Defined in Text.XML.HXT.RelaxNG.DataTypeLibUtils | |
| MonadPlus m => ArrowZero (Kleisli m) | |
Defined in GHC.Internal.Control.Arrow | |
| ArrowZero (IOSLA s) | |
Defined in Control.Arrow.IOStateListArrow | |
| ArrowZero (SLA s) | |
Defined in Control.Arrow.StateListArrow | |
newtype Kleisli (m :: Type -> Type) a b #
Constructors
| Kleisli | |
Fields
| |
Instances
| Monad m => Category (Kleisli m :: Type -> Type -> Type) | |||||
| Generic1 (Kleisli m a :: Type -> Type) | |||||
Defined in GHC.Internal.Control.Arrow Associated Types
| |||||
| Monad m => Arrow (Kleisli m) | |||||
Defined in GHC.Internal.Control.Arrow | |||||
| Monad m => ArrowApply (Kleisli m) | |||||
Defined in GHC.Internal.Control.Arrow | |||||
| Monad m => ArrowChoice (Kleisli m) | |||||
Defined in GHC.Internal.Control.Arrow | |||||
| MonadFix m => ArrowLoop (Kleisli m) | |||||
Defined in GHC.Internal.Control.Arrow | |||||
| MonadPlus m => ArrowPlus (Kleisli m) | |||||
| MonadPlus m => ArrowZero (Kleisli m) | |||||
Defined in GHC.Internal.Control.Arrow | |||||
| Alternative m => Alternative (Kleisli m a) | |||||
| Applicative m => Applicative (Kleisli m a) | |||||
Defined in GHC.Internal.Control.Arrow | |||||
| Functor m => Functor (Kleisli m a) | |||||
| Monad m => Monad (Kleisli m a) | |||||
| MonadPlus m => MonadPlus (Kleisli m a) | |||||
| Generic (Kleisli m a b) | |||||
Defined in GHC.Internal.Control.Arrow Associated Types
| |||||
| type Rep1 (Kleisli m a :: Type -> Type) | |||||
Defined in GHC.Internal.Control.Arrow type Rep1 (Kleisli m a :: Type -> Type) = D1 ('MetaData "Kleisli" "GHC.Internal.Control.Arrow" "ghc-internal" 'True) (C1 ('MetaCons "Kleisli" 'PrefixI 'True) (S1 ('MetaSel ('Just "runKleisli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) ((FUN 'Many a :: Type -> Type) :.: Rec1 m))) | |||||
| type Rep (Kleisli m a b) | |||||
Defined in GHC.Internal.Control.Arrow type Rep (Kleisli m a b) = D1 ('MetaData "Kleisli" "GHC.Internal.Control.Arrow" "ghc-internal" 'True) (C1 ('MetaCons "Kleisli" 'PrefixI 'True) (S1 ('MetaSel ('Just "runKleisli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> m b)))) | |||||
module Text.XML.HXT.DOM.Util
module Text.XML.HXT.RelaxNG.Utils
type FunctionTable = [(String, String -> String -> Bool)] Source #
Function table type
stringValidFT :: FunctionTable -> DatatypeName -> Integer -> Integer -> ParamList -> CheckString Source #
fctTableString :: FunctionTable Source #
Function table for string tests, XML document value is first operand, schema value second
fctTableList :: FunctionTable Source #
Function table for list tests, XML document value is first operand, schema value second
stringValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString Source #
Tests whether a "string" datatype value is between the lower and upper bound of the datatype and matches all parameters.
All tests are performed on the string value.
- 1.parameter : datatype
- 2.parameter : lower bound of the datatype range
- 3.parameter : upper bound of the datatype range (-1 = no upper bound)
- 4.parameter : list of parameters
- 5.parameter : datatype value to be checked
- return : Just "Errormessage" in case of an error, else Nothing
numberValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString Source #
Tests whether a "numeric" datatype value is between the lower and upper bound of the datatype and matches all parameters.
First, the string value is parsed into a numeric representation. If no error occur, all following tests are performed on the numeric value.
- 1.parameter : datatype
- 2.parameter : lower bound of the datatype range
- 3.parameter : upper bound of the datatype range (-1 = no upper bound)
- 4.parameter : list of parameters
- 5.parameter : datatype value to be checked
- return : Just "Errormessage" in case of an error, else Nothing
numParamValid :: (Integer -> Integer -> Bool) -> String -> String -> Bool Source #
tests whether a string value matches a numeric param
valid example:
<data type="CHAR"> <param name="maxLength">5</param> </data>
invalid example:
<data type="CHAR"> <param name="minLength">foo</param> </data>
type CheckString = CheckA String String Source #
type CheckInteger = CheckA Integer Integer Source #
performCheck :: CheckA a b -> a -> Maybe String Source #
run a check and deliver Just an error message or Nothing
assert :: (a -> Bool) -> (a -> String) -> CheckA a a Source #
perform a simple check with a predicate p, when the predicate holds, assert acts as identity, else an error message is generated
assertMaybe :: (a -> Maybe b) -> (a -> String) -> CheckA a b Source #
perform a simple check with a Maybe function, Nothing indicates error