configuration-tools-0.3.0: Tools for specifying and parsing configurations

CopyrightCopyright © 2014 AlephCloud Systems Inc.
LicenseMIT
MaintainerLars Kuhtz <lars@alephcloud.com>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Configuration.Utils.Validation

Contents

Description

Utilities for validating configuration values

Synopsis

Documentation

type ConfigValidation α λ = forall μ. (MonadIO μ, Functor μ, Applicative μ, MonadError Text μ, MonadWriterText) μ) => α -> μ () 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 α, Monoid α) 
=> Text

configuration property name that is used in the error message

-> α 
-> m () 

validateLength Source #

Arguments

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

configuration property name that is used in the error message

-> Int

exact length of the validated value

-> φ α 
-> m () 

validateMinLength Source #

Arguments

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

configuration property name that is used in the error message

-> Int

minimum length of the validated value

-> φ α 
-> m () 

validateMaxLength Source #

Arguments

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

configuration property name that is used in the error message

-> Int

maximum length of the validated value

-> φ α 
-> m () 

validateMinMaxLength Source #

Arguments

:: (MonadError Text m, Foldable φ) 
=> 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

-> φ α 
-> 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 α, Num α) 
=> Text

configuration property name that is used in the error message

-> α 
-> m () 

validatePositive Source #

Arguments

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

configuration property name that is used in the error message

-> α 
-> m () 

validateNonPositive Source #

Arguments

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

configuration property name that is used in the error message

-> α 
-> m () 

validateNegative Source #

Arguments

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

configuration property name that is used in the error message

-> α 
-> m () 

validateNonNull Source #

Arguments

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

configuration property name that is used in the error message

-> α 
-> m () 

Orders

validateLess Source #

Arguments

:: (MonadError Text m, Ord α, Show α) 
=> Text

configuration property name that is used in the error message

-> α

a strict upper bound for the configuration value

-> α 
-> m () 

validateLessEq Source #

Arguments

:: (MonadError Text m, Ord α, Show α) 
=> Text

configuration property name that is used in the error message

-> α

a upper bound for the configuration value

-> α 
-> m () 

validateGreater Source #

Arguments

:: (MonadError Text m, Ord α, Show α) 
=> Text

configuration property name that is used in the error message

-> α

a strict lower bound for the configuration value

-> α 
-> m () 

validateGreaterEq Source #

Arguments

:: (MonadError Text m, Ord α, Show α) 
=> Text

configuration property name that is used in the error message

-> α

a lower bound for the configuration value

-> α 
-> m () 

validateRange Source #

Arguments

:: (MonadError Text m, Ord α, Show α) 
=> Text

configuration property name that is used in the error message

-> (α, α)

the valid range for the configuration value

-> α 
-> m ()