config-schema-0.4.1.0: Schema definitions for the config-value package

Copyright(c) Eric Mertens 2017
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Config.Schema.Load

Contents

Description

This module automates the extraction of a decoded value from a configuration value according to a specification as built using Config.Schema.Spec.

Synopsis

Documentation

loadValue Source #

Arguments

:: ValueSpecs a

specification

-> Value p

value

-> Either (NonEmpty (LoadError p)) a

errors or decoded value

Match a Value against a ValueSpecs and return either the interpretation of that value or the list of errors encountered.

loadValueFromFile Source #

Arguments

:: FilePath

filename

-> ValueSpecs a

specification

-> IO a 

Read a configuration file, parse it, and validate it according to the given specification.

Throws IOError, ParseError, or SchemaError

Errors

data LoadError p Source #

Type for errors that can be encountered while decoding a value according to a specification. The error includes a key path indicating where in the configuration file the error occurred.

Constructors

LoadError p [Text] Problem

position, path, problem

data Problem Source #

Problems that can be encountered when matching a Value against a ValueSpecs.

Constructors

MissingSection Text

missing section name

UnusedSection Text

unused section names

SpecMismatch Text

failed specification name