configuration-tools-0.6.1: Tools for specifying and parsing configurations
CopyrightCopyright © 2014 AlephCloud Systems Inc.
LicenseMIT
MaintainerLars Kuhtz <lars@alephcloud.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Configuration.Utils.Validation

Description

Utilities for validating configuration values

Synopsis

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 #

Arguments

:: 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

validateHttpUrl Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> String 
-> m () 

Validates that a value is an HTTP URL

validateHttpsUrl Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> String 
-> m () 

Validates that a value is an HTTPS URL

validateUri Source #

Arguments

:: 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

validateAbsoluteUri Source #

Arguments

:: 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 #

Arguments

:: 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

validateIPv4 Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> String 
-> m () 

validateIPv6 Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> String 
-> m () 

validatePort Source #

Arguments

:: (MonadError Text m, Integral n, Show n) 
=> Text

configuration property name that is used in the error message

-> n 
-> m () 

Monoids, Foldables and Co

validateNonEmpty Source #

Arguments

:: (MonadError Text m, Eq a, Monoid a) 
=> Text

configuration property name that is used in the error message

-> a 
-> m () 

validateLength Source #

Arguments

:: (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 () 

validateMinLength Source #

Arguments

:: (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 () 

validateMaxLength Source #

Arguments

:: (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 () 

validateMinMaxLength Source #

Arguments

:: (MonadError Text m, Foldable f) 
=> Text

configuration property name that is used in the error message

-> Int

minimum length of the validated value

-> Int

maximum length of the validated value

-> f a 
-> m () 

Files

validateFilePath Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> FilePath 
-> m () 

validateFile Source #

Arguments

:: (MonadError Text m, MonadIO m) 
=> Text

configuration property name that is used in the error message

-> FilePath 
-> m () 

validateFileReadable Source #

Arguments

:: (MonadError Text m, MonadIO m) 
=> Text

configuration property name that is used in the error message

-> FilePath 
-> m () 

validateFileWritable Source #

Arguments

:: (MonadError Text m, MonadIO m) 
=> Text

configuration property name that is used in the error message

-> FilePath 
-> m () 

validateExecutable Source #

Arguments

:: (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.

validateDirectory Source #

Arguments

:: (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

validateFalse Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> Bool 
-> m () 

validateTrue Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> Bool 
-> m () 

validateBool Source #

Arguments

:: MonadError Text m 
=> Text

configuration property name that is used in the error message

-> Bool

expected value

-> Bool 
-> m () 

Numeric Values

validateNonNegative Source #

Arguments

:: (MonadError Text m, Ord a, Num a) 
=> Text

configuration property name that is used in the error message

-> a 
-> m () 

validatePositive Source #

Arguments

:: (MonadError Text m, Ord a, Num a) 
=> Text

configuration property name that is used in the error message

-> a 
-> m () 

validateNonPositive Source #

Arguments

:: (MonadError Text m, Ord a, Num a) 
=> Text

configuration property name that is used in the error message

-> a 
-> m () 

validateNegative Source #

Arguments

:: (MonadError Text m, Ord a, Num a) 
=> Text

configuration property name that is used in the error message

-> a 
-> m () 

validateNonNull Source #

Arguments

:: (MonadError Text m, Eq a, Num a) 
=> Text

configuration property name that is used in the error message

-> a 
-> m () 

Orders

validateLess Source #

Arguments

:: (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 () 

validateLessEq Source #

Arguments

:: (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 () 

validateGreater Source #

Arguments

:: (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 () 

validateGreaterEq Source #

Arguments

:: (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 () 

validateRange Source #

Arguments

:: (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 ()