-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Declarative configuration spec for Haskell projects -- -- Please see README.md @package etc @version 0.0.0.2 module System.Etc.Internal.Spec.Types data ConfigurationError InvalidConfiguration :: Text -> ConfigurationError InvalidConfigKeyPath :: [Text] -> ConfigurationError ConfigurationFileNotFound :: Text -> ConfigurationError data CliOptValueType StringOpt :: CliOptValueType NumberOpt :: CliOptValueType SwitchOpt :: CliOptValueType data CliArgValueType StringArg :: CliArgValueType NumberArg :: CliArgValueType data CliEntryMetadata Opt :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Bool -> CliOptValueType -> CliEntryMetadata [optLong] :: CliEntryMetadata -> Maybe Text [optShort] :: CliEntryMetadata -> Maybe Text [optMetavar] :: CliEntryMetadata -> Maybe Text [optHelp] :: CliEntryMetadata -> Maybe Text [optRequired] :: CliEntryMetadata -> Bool [optValueType] :: CliEntryMetadata -> CliOptValueType Arg :: Maybe Text -> Bool -> CliArgValueType -> CliEntryMetadata [argMetavar] :: CliEntryMetadata -> Maybe Text [optRequired] :: CliEntryMetadata -> Bool [argValueType] :: CliEntryMetadata -> CliArgValueType data CliEntrySpec cmd CmdEntry :: Vector cmd -> CliEntryMetadata -> CliEntrySpec cmd [cliEntryCmdValue] :: CliEntrySpec cmd -> Vector cmd [cliEntryMetadata] :: CliEntrySpec cmd -> CliEntryMetadata PlainEntry :: CliEntryMetadata -> CliEntrySpec cmd [cliEntryMetadata] :: CliEntrySpec cmd -> CliEntryMetadata data CliCmdSpec CliCmdSpec :: Text -> Text -> CliCmdSpec [cliCmdDesc] :: CliCmdSpec -> Text [cliCmdHeader] :: CliCmdSpec -> Text data ConfigSources cmd ConfigSources :: Maybe Text -> Maybe (CliEntrySpec cmd) -> ConfigSources cmd [envVar] :: ConfigSources cmd -> Maybe Text [cliEntry] :: ConfigSources cmd -> Maybe (CliEntrySpec cmd) data ConfigValue cmd ConfigValue :: Maybe Value -> ConfigSources cmd -> ConfigValue cmd [defaultValue] :: ConfigValue cmd -> Maybe Value [configSources] :: ConfigValue cmd -> ConfigSources cmd SubConfig :: HashMap Text (ConfigValue cmd) -> ConfigValue cmd [subConfig] :: ConfigValue cmd -> HashMap Text (ConfigValue cmd) data CliProgramSpec CliProgramSpec :: Text -> Text -> Maybe (HashMap Text CliCmdSpec) -> CliProgramSpec [cliProgramDesc] :: CliProgramSpec -> Text [cliProgramHeader] :: CliProgramSpec -> Text [cliCommands] :: CliProgramSpec -> Maybe (HashMap Text CliCmdSpec) data ConfigSpec cmd ConfigSpec :: [Text] -> Maybe CliProgramSpec -> HashMap Text (ConfigValue cmd) -> ConfigSpec cmd [specConfigFilepaths] :: ConfigSpec cmd -> [Text] [specCliProgramSpec] :: ConfigSpec cmd -> Maybe CliProgramSpec [specConfigValues] :: ConfigSpec cmd -> HashMap Text (ConfigValue cmd) cliArgTypeParser :: Object -> Parser CliArgValueType cliArgParser :: Object -> Parser CliEntryMetadata cliOptTypeParser :: Object -> Parser CliOptValueType cliOptParser :: Object -> Parser CliEntryMetadata cliArgKeys :: [Text] cliOptKeys :: [Text] instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.ConfigSpec cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.ConfigSpec cmd) instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliProgramSpec instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliProgramSpec instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.ConfigSources cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.ConfigSources cmd) instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliCmdSpec instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliCmdSpec instance GHC.Classes.Eq cmd => GHC.Classes.Eq (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance GHC.Show.Show cmd => GHC.Show.Show (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliEntryMetadata instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliEntryMetadata instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliArgValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliArgValueType instance GHC.Classes.Eq System.Etc.Internal.Spec.Types.CliOptValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.CliOptValueType instance GHC.Show.Show System.Etc.Internal.Spec.Types.ConfigurationError instance GHC.Exception.Exception System.Etc.Internal.Spec.Types.ConfigurationError instance Data.Aeson.Types.FromJSON.FromJSON System.Etc.Internal.Spec.Types.CliCmdSpec instance Data.Aeson.Types.FromJSON.FromJSON System.Etc.Internal.Spec.Types.CliProgramSpec instance Data.Aeson.Types.FromJSON.FromJSON cmd => Data.Aeson.Types.FromJSON.FromJSON (System.Etc.Internal.Spec.Types.CliEntrySpec cmd) instance Data.Aeson.Types.FromJSON.FromJSON cmd => Data.Aeson.Types.FromJSON.FromJSON (System.Etc.Internal.Spec.Types.ConfigValue cmd) instance Data.Aeson.Types.FromJSON.FromJSON cmd => Data.Aeson.Types.FromJSON.FromJSON (System.Etc.Internal.Spec.Types.ConfigSpec cmd) module System.Etc.Internal.Types data ConfigSource File :: Int -> Text -> Value -> ConfigSource [configIndex] :: ConfigSource -> Int [filepath] :: ConfigSource -> Text [value] :: ConfigSource -> Value Env :: Text -> Value -> ConfigSource [envVar] :: ConfigSource -> Text [value] :: ConfigSource -> Value Cli :: Value -> ConfigSource [value] :: ConfigSource -> Value Default :: Value -> ConfigSource [value] :: ConfigSource -> Value None :: ConfigSource data ConfigValue ConfigValue :: Set ConfigSource -> ConfigValue [configSource] :: ConfigValue -> Set ConfigSource SubConfig :: HashMap Text ConfigValue -> ConfigValue [configMap] :: ConfigValue -> HashMap Text ConfigValue deepMerge :: ConfigValue -> ConfigValue -> ConfigValue newtype Config Config :: ConfigValue -> Config [fromConfig] :: Config -> ConfigValue isEmptySubConfig :: ConfigValue -> Bool emptySubConfig :: ConfigValue writeInSubConfig :: Text -> ConfigValue -> ConfigValue -> ConfigValue filterMaybe :: (a -> Bool) -> Maybe a -> Maybe a instance GHC.Base.Monoid System.Etc.Internal.Types.Config instance GHC.Show.Show System.Etc.Internal.Types.Config instance GHC.Classes.Eq System.Etc.Internal.Types.Config instance GHC.Show.Show System.Etc.Internal.Types.ConfigValue instance GHC.Classes.Eq System.Etc.Internal.Types.ConfigValue instance GHC.Classes.Eq System.Etc.Internal.Types.ConfigSource instance GHC.Show.Show System.Etc.Internal.Types.ConfigSource instance GHC.Classes.Ord System.Etc.Internal.Types.ConfigSource instance GHC.Base.Monoid System.Etc.Internal.Types.ConfigValue module System.Etc.Internal.Spec.JSON parseConfigSpec :: (MonadThrow m, FromJSON cmd) => Text -> m (ConfigSpec cmd) readConfigSpec :: FromJSON cmd => Text -> IO (ConfigSpec cmd) module System.Etc.Spec -- | Parses a text input into a ConfigSpec, input can be JSON or -- YAML (if cabal flag is set). parseConfigSpec :: (MonadCatch m, FromJSON cmd) => Text -> m (ConfigSpec cmd) -- | Reads contents of a file and parses into a ConfigSpec, file -- contents can be either JSON or YAML (if cabal flag is set). readConfigSpec :: FromJSON cmd => Text -> IO (ConfigSpec cmd) module System.Etc.Internal.Resolver.File -- | Gathers configuration values from a list of files specified on the -- etc/filepaths entry of a Config Spec. This will return a -- Configuration Map with values from all filepaths merged in, and a list -- of errors in case there was an error reading one of the filepaths. resolveFiles :: ConfigSpec cmd -> IO (Config, Vector SomeException) instance GHC.Classes.Eq System.Etc.Internal.Resolver.File.ConfigFile instance GHC.Show.Show System.Etc.Internal.Resolver.File.ConfigFile module System.Etc.Internal.Resolver.Env -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec. resolveEnv :: ConfigSpec cmd -> IO Config -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec. This -- version of the function gathers the input from a list of tuples rather -- than the OS. resolveEnvPure :: ConfigSpec cmd -> [(Text, Text)] -> Config module System.Etc.Internal.Resolver.Default -- | Gathers all default values from the etc/spec entries inside a -- ConfigSpec resolveDefault :: ConfigSpec cmd -> Config module System.Etc.Internal.Config configValueToJsonObject :: ConfigValue -> Value getConfigValueWith :: MonadThrow m => (Value -> Parser a) -> [Text] -> Config -> m a getSelectedConfigSource :: (MonadThrow m) => [Text] -> Config -> m ConfigSource getAllConfigSources :: (MonadThrow m) => [Text] -> Config -> m (Set ConfigSource) getConfigValue :: (MonadThrow m, FromJSON result) => [Text] -> Config -> m result module System.Etc data Config getConfigValue :: (MonadThrow m, FromJSON result) => [Text] -> Config -> m result getConfigValueWith :: MonadThrow m => (Value -> Parser a) -> [Text] -> Config -> m a getSelectedConfigSource :: (MonadThrow m) => [Text] -> Config -> m ConfigSource getAllConfigSources :: (MonadThrow m) => [Text] -> Config -> m (Set ConfigSource) data ConfigSource File :: Int -> Text -> Value -> ConfigSource [configIndex] :: ConfigSource -> Int [filepath] :: ConfigSource -> Text [value] :: ConfigSource -> Value Env :: Text -> Value -> ConfigSource [envVar] :: ConfigSource -> Text [value] :: ConfigSource -> Value Cli :: Value -> ConfigSource [value] :: ConfigSource -> Value Default :: Value -> ConfigSource [value] :: ConfigSource -> Value None :: ConfigSource data ConfigValue data ConfigSpec cmd data ConfigurationError InvalidConfiguration :: Text -> ConfigurationError InvalidConfigKeyPath :: [Text] -> ConfigurationError ConfigurationFileNotFound :: Text -> ConfigurationError -- | Parses a text input into a ConfigSpec, input can be JSON or -- YAML (if cabal flag is set). parseConfigSpec :: (MonadCatch m, FromJSON cmd) => Text -> m (ConfigSpec cmd) -- | Reads contents of a file and parses into a ConfigSpec, file -- contents can be either JSON or YAML (if cabal flag is set). readConfigSpec :: FromJSON cmd => Text -> IO (ConfigSpec cmd) -- | Gathers all default values from the etc/spec entries inside a -- ConfigSpec resolveDefault :: ConfigSpec cmd -> Config -- | Gathers configuration values from a list of files specified on the -- etc/filepaths entry of a Config Spec. This will return a -- Configuration Map with values from all filepaths merged in, and a list -- of errors in case there was an error reading one of the filepaths. resolveFiles :: ConfigSpec cmd -> IO (Config, Vector SomeException) -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec. This -- version of the function gathers the input from a list of tuples rather -- than the OS. resolveEnvPure :: ConfigSpec cmd -> [(Text, Text)] -> Config -- | Gathers all OS Environment Variable values (env entries) from -- the etc/spec entries inside a ConfigSpec. resolveEnv :: ConfigSpec cmd -> IO Config