configurator-ng-0.0.0.1: The next generation of configuration management

Copyright | (c) 2015-2016 Leon P Smith
License | BSD3
Maintainer | Leon P Smith <leon@melding-monads.com>
Safe Haskell | None
Language | Haskell98

Data.Configurator.Parser.Internal

Description

Synopsis

- type RMW r w a = r -> (Maybe a, w)
- type ConfigErrors = Maybe (DList ConfigError)
- class Applicative m => ConfigParser m where
- newtype ConfigParserM a = ConfigParserM {
  - unConfigParserM :: RMW Config ConfigErrors a
  }
- newtype ConfigParserA a = ConfigParserA {
  - unConfigParserA :: RMW Config ConfigErrors a
  }
- newtype ConfigTransform = ConfigTransform (ConfigPlan ())
- interpConfigTransform :: ConfigTransform -> Config -> Config

# Documentation

type RMW r w a = r -> (Maybe a, w) #

type ConfigErrors = Maybe (DList ConfigError) #

class Applicative m => ConfigParser m where #

A `ConfigParser` computation produces a value of type ``Maybe` a` from a given `Config`, in addition to a list of diagnostic messages, which may be interpreted as warnings or errors as deemed appropriate. The type class abstracts over `ConfigParserM` and `ConfigParserA` variants, which are isomorphic but have different `Applicative` and `Monad` instances. This is intended to be a closed typeclass, without any additional instances.

Minimal complete definition

configParser_, unConfigParser_

Methods

configParser_ :: RMW Config ConfigErrors a -> m a #

unConfigParser_ :: m a -> RMW Config ConfigErrors a #

Instances

ConfigParser ConfigParserA # |
Methods configParser_ :: RMW Config ConfigErrors a -> ConfigParserA a # unConfigParser_ :: ConfigParserA a -> RMW Config ConfigErrors a #
ConfigParser ConfigParserM # |
Methods configParser_ :: RMW Config ConfigErrors a -> ConfigParserM a # unConfigParser_ :: ConfigParserM a -> RMW Config ConfigErrors a #

newtype ConfigParserM a #

If the value returned by a computation is `Nothing`, then no subsequent actions (e.g. via `<*>` or `>>=`) will be performed.

Constructors

ConfigParserM |
Fields unConfigParserM :: RMW Config ConfigErrors a

Instances

Monad ConfigParserM # |
Methods (>>=) :: ConfigParserM a -> (a -> ConfigParserM b) -> ConfigParserM b # (>>) :: ConfigParserM a -> ConfigParserM b -> ConfigParserM b # return :: a -> ConfigParserM a # fail :: String -> ConfigParserM a #
Functor ConfigParserM # |
Methods fmap :: (a -> b) -> ConfigParserM a -> ConfigParserM b # (<$) :: a -> ConfigParserM b -> ConfigParserM a #
Applicative ConfigParserM # |
Methods pure :: a -> ConfigParserM a # (<*>) :: ConfigParserM (a -> b) -> ConfigParserM a -> ConfigParserM b # (*>) :: ConfigParserM a -> ConfigParserM b -> ConfigParserM b # (<*) :: ConfigParserM a -> ConfigParserM b -> ConfigParserM a #
ConfigParser ConfigParserM # |
Methods configParser_ :: RMW Config ConfigErrors a -> ConfigParserM a # unConfigParser_ :: ConfigParserM a -> RMW Config ConfigErrors a #

newtype ConfigParserA a #

After executing a subcomputation that returns a `Nothing` value, computations of type `ConfigParserA` will continue to run in order to produce more error messages. For this reason, `ConfigParserA` does not have a proper `Monad` instance. (But see `unsafeBind`)

Constructors

ConfigParserA |
Fields unConfigParserA :: RMW Config ConfigErrors a

Instances

Functor ConfigParserA # |
Methods fmap :: (a -> b) -> ConfigParserA a -> ConfigParserA b # (<$) :: a -> ConfigParserA b -> ConfigParserA a #
Applicative ConfigParserA # |
Methods pure :: a -> ConfigParserA a # (<*>) :: ConfigParserA (a -> b) -> ConfigParserA a -> ConfigParserA b # (*>) :: ConfigParserA a -> ConfigParserA b -> ConfigParserA b # (<*) :: ConfigParserA a -> ConfigParserA b -> ConfigParserA a #
ConfigParser ConfigParserA # |
Methods configParser_ :: RMW Config ConfigErrors a -> ConfigParserA a # unConfigParser_ :: ConfigParserA a -> RMW Config ConfigErrors a #

newtype ConfigTransform #

Conceptually, a `ConfigTransform` is a function `Config` `->` `Config`. It's a restricted subset of such functions as to preserve the possibility of reliable dependency tracking in later versions of configurator-ng.

Constructors

ConfigTransform (ConfigPlan ()) |

Instances

Monoid ConfigTransform # | `mempty` is the identity `ConfigTransform`, `mappend` is the composition of two `ConfigTransform`s.
Methods mempty :: ConfigTransform # mappend :: ConfigTransform -> ConfigTransform -> ConfigTransform # mconcat :: [ConfigTransform] -> ConfigTransform #

interpConfigTransform :: ConfigTransform -> Config -> Config #