-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple, layout-based value language similar to YAML or JSON -- @package config-value @version 0.2 -- | This module parses files using the syntax demonstrated below. The full -- grammar is available in the Happy source file. -- --
-- -- Line comments until newline
-- layout:
-- based:
-- configuration:
-- {} -- empty section
--
-- sections:
-- "glguy"
--
-- booleans : yes
-- complicated: no
--
-- decimal : -1234
-- hexadecimal: 0x1234
-- octal : 0o1234
-- binary : 0b1010
--
-- lists:
-- * 1
-- * [ "inline", "lists" ]
-- * * "nestable"
-- * "layout"
-- * "lists"
-- * 3
--
-- unicode : "standard Haskell format strings (1 ≤ 2)\x2228(2 ≤ 3)"
--
module Config
-- | A single section of a Value
data Section
Section :: Text -> Value -> Section
sectionName :: Section -> Text
sectionValue :: Section -> Value
-- | Sum type of the values supported by this language.
data Value
Sections :: [Section] -> Value
-- | base number
Number :: Int -> Integer -> Value
Text :: Text -> Value
Bool :: Bool -> Value
List :: [Value] -> Value
-- | Parse a configuration value and return the result on the right, or the
-- position of an error on the left.
parse :: Text -> Either (Int, Int) Value
-- | Pretty-print a Value as shown in the example. Sections will
-- nest complex values underneath with indentation and simple values will
-- be rendered on the same line as their section.
pretty :: Value -> Doc
-- | Optics for compatibility with the lens package
module Config.Lens
-- | Apply a function to the subsections of the given value when that value
-- is a Sections and the subsection name matches the given
-- section name
key :: Applicative f => Text -> (Value -> f Value) -> Value -> f Value
-- | Apply a function to the Text contained inside the given
-- Value when it is a Text.
text :: Applicative f => (Text -> f Text) -> Value -> f Value
-- | Apply a function to the Integer contained inside the given
-- Value when it is a Number.
number :: Applicative f => (Integer -> f Integer) -> Value -> f Value
-- | Apply a function to the Bool contained inside the given
-- Value when it is a Bool.
bool :: Applicative f => (Bool -> f Bool) -> Value -> f Value
-- | Apply a function to the [Value] contained inside the given
-- Value when it is a List.
list :: Applicative f => ([Value] -> f [Value]) -> Value -> f Value
-- | Apply a function to the [Section] contained inside the given
-- Value when it is a Sections.
sections :: Applicative f => ([Section] -> f [Section]) -> Value -> f Value