Copyright | Copyright © 2014 AlephCloud Systems Inc. |
---|---|
License | MIT |
Maintainer | Lars Kuhtz <lars@alephcloud.com> |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Utilities for validating configuration values
Synopsis
- type ConfigValidation a f = forall m. (MonadIO m, Functor m, Applicative m, MonadError Text m, MonadWriter (f Text) m) => a -> m ()
- validateHttpOrHttpsUrl :: MonadError Text m => Text -> String -> m ()
- validateHttpUrl :: MonadError Text m => Text -> String -> m ()
- validateHttpsUrl :: MonadError Text m => Text -> String -> m ()
- validateUri :: MonadError Text m => Text -> String -> m ()
- validateAbsoluteUri :: MonadError Text m => Text -> String -> m ()
- validateAbsoluteUriFragment :: MonadError Text m => Text -> String -> m ()
- validateIPv4 :: MonadError Text m => Text -> String -> m ()
- validateIPv6 :: MonadError Text m => Text -> String -> m ()
- validatePort :: (MonadError Text m, Integral n, Show n) => Text -> n -> m ()
- validateNonEmpty :: (MonadError Text m, Eq a, Monoid a) => Text -> a -> m ()
- validateLength :: (MonadError Text m, Foldable f) => Text -> Int -> f a -> m ()
- validateMinLength :: (MonadError Text m, Foldable f) => Text -> Int -> f a -> m ()
- validateMaxLength :: (MonadError Text m, Foldable f) => Text -> Int -> f a -> m ()
- validateMinMaxLength :: (MonadError Text m, Foldable f) => Text -> Int -> Int -> f a -> m ()
- validateFilePath :: MonadError Text m => Text -> FilePath -> m ()
- validateFile :: (MonadError Text m, MonadIO m) => Text -> FilePath -> m ()
- validateFileReadable :: (MonadError Text m, MonadIO m) => Text -> FilePath -> m ()
- validateFileWritable :: (MonadError Text m, MonadIO m) => Text -> FilePath -> m ()
- validateExecutable :: (Functor m, MonadError Text m, MonadIO m) => Text -> FilePath -> m ()
- validateDirectory :: (MonadError Text m, MonadIO m) => Text -> FilePath -> m ()
- validateConfigFile :: (MonadIO m, MonadError Text m) => String -> m ()
- validateFalse :: MonadError Text m => Text -> Bool -> m ()
- validateTrue :: MonadError Text m => Text -> Bool -> m ()
- validateBool :: MonadError Text m => Text -> Bool -> Bool -> m ()
- validateNonNegative :: (MonadError Text m, Ord a, Num a) => Text -> a -> m ()
- validatePositive :: (MonadError Text m, Ord a, Num a) => Text -> a -> m ()
- validateNonPositive :: (MonadError Text m, Ord a, Num a) => Text -> a -> m ()
- validateNegative :: (MonadError Text m, Ord a, Num a) => Text -> a -> m ()
- validateNonNull :: (MonadError Text m, Eq a, Num a) => Text -> a -> m ()
- validateLess :: (MonadError Text m, Ord a, Show a) => Text -> a -> a -> m ()
- validateLessEq :: (MonadError Text m, Ord a, Show a) => Text -> a -> a -> m ()
- validateGreater :: (MonadError Text m, Ord a, Show a) => Text -> a -> a -> m ()
- validateGreaterEq :: (MonadError Text m, Ord a, Show a) => Text -> a -> a -> m ()
- validateRange :: (MonadError Text m, Ord a, Show a) => Text -> (a, a) -> a -> m ()
Documentation
type ConfigValidation a f = forall m. (MonadIO m, Functor m, Applicative m, MonadError Text m, MonadWriter (f Text) m) => a -> m () Source #
A validation function. The type in the MonadWriter
is excpected to
be a Foldable
structure for collecting warnings.
Networking
validateHttpOrHttpsUrl Source #
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
Validates that a value is an HTTP or HTTPS URL
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
Validates that a value is an HTTP URL
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
Validates that a value is an HTTPS URL
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
Validates that a value is an URI without a fragment identifier
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
Validates that a value is an absolute URI without a fragment identifier
validateAbsoluteUriFragment Source #
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
Validates that a value is an absolute URI with an optional fragment identifier
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> String | |
-> m () |
:: (MonadError Text m, Integral n, Show n) | |
=> Text | configuration property name that is used in the error message |
-> n | |
-> m () |
Monoids, Foldables and Co
:: (MonadError Text m, Eq a, Monoid a) | |
=> Text | configuration property name that is used in the error message |
-> a | |
-> m () |
:: (MonadError Text m, Foldable f) | |
=> Text | configuration property name that is used in the error message |
-> Int | exact length of the validated value |
-> f a | |
-> m () |
:: (MonadError Text m, Foldable f) | |
=> Text | configuration property name that is used in the error message |
-> Int | minimum length of the validated value |
-> f a | |
-> m () |
:: (MonadError Text m, Foldable f) | |
=> Text | configuration property name that is used in the error message |
-> Int | maximum length of the validated value |
-> f a | |
-> m () |
Files
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> FilePath | |
-> m () |
:: (MonadError Text m, MonadIO m) | |
=> Text | configuration property name that is used in the error message |
-> FilePath | |
-> m () |
:: (MonadError Text m, MonadIO m) | |
=> Text | configuration property name that is used in the error message |
-> FilePath | |
-> m () |
:: (MonadError Text m, MonadIO m) | |
=> Text | configuration property name that is used in the error message |
-> FilePath | |
-> m () |
:: (Functor m, MonadError Text m, MonadIO m) | |
=> Text | configuration property name that is used in the error message |
-> FilePath | |
-> m () |
Validates if the given executable name can be found in the system and can be executed.
:: (MonadError Text m, MonadIO m) | |
=> Text | configuration property name that is used in the error message |
-> FilePath | |
-> m () |
validateConfigFile :: (MonadIO m, MonadError Text m) => String -> m () Source #
Validate that the input is a config file
Boolean Values
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> Bool | |
-> m () |
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> Bool | |
-> m () |
:: MonadError Text m | |
=> Text | configuration property name that is used in the error message |
-> Bool | expected value |
-> Bool | |
-> m () |
Numeric Values
:: (MonadError Text m, Ord a, Num a) | |
=> Text | configuration property name that is used in the error message |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Num a) | |
=> Text | configuration property name that is used in the error message |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Num a) | |
=> Text | configuration property name that is used in the error message |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Num a) | |
=> Text | configuration property name that is used in the error message |
-> a | |
-> m () |
:: (MonadError Text m, Eq a, Num a) | |
=> Text | configuration property name that is used in the error message |
-> a | |
-> m () |
Orders
:: (MonadError Text m, Ord a, Show a) | |
=> Text | configuration property name that is used in the error message |
-> a | a strict upper bound for the configuration value |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Show a) | |
=> Text | configuration property name that is used in the error message |
-> a | a upper bound for the configuration value |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Show a) | |
=> Text | configuration property name that is used in the error message |
-> a | a strict lower bound for the configuration value |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Show a) | |
=> Text | configuration property name that is used in the error message |
-> a | a lower bound for the configuration value |
-> a | |
-> m () |
:: (MonadError Text m, Ord a, Show a) | |
=> Text | configuration property name that is used in the error message |
-> (a, a) | the valid range for the configuration value |
-> a | |
-> m () |