module Data.Configurator.Types
( Value(..)
, Directive(..)
, ParseError(..)
, Key
, Path
, Config
, Interpolate (..)
) where
import Protolude
import Data.Scientific (Scientific)
newtype ParseError = ParseError Text
deriving (Int -> ParseError -> ShowS
[ParseError] -> ShowS
ParseError -> String
(Int -> ParseError -> ShowS)
-> (ParseError -> String)
-> ([ParseError] -> ShowS)
-> Show ParseError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParseError -> ShowS
showsPrec :: Int -> ParseError -> ShowS
$cshow :: ParseError -> String
show :: ParseError -> String
$cshowList :: [ParseError] -> ShowS
showList :: [ParseError] -> ShowS
Show)
instance Exception ParseError
type Config = Map Key Value
type Key = Text
type Path = Text
data Directive = Import Path
| Bind Key Value
| Group Key [Directive]
| Directive
deriving (Directive -> Directive -> Bool
(Directive -> Directive -> Bool)
-> (Directive -> Directive -> Bool) -> Eq Directive
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Directive -> Directive -> Bool
== :: Directive -> Directive -> Bool
$c/= :: Directive -> Directive -> Bool
/= :: Directive -> Directive -> Bool
Eq, Int -> Directive -> ShowS
[Directive] -> ShowS
Directive -> String
(Int -> Directive -> ShowS)
-> (Directive -> String)
-> ([Directive] -> ShowS)
-> Show Directive
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Directive -> ShowS
showsPrec :: Int -> Directive -> ShowS
$cshow :: Directive -> String
show :: Directive -> String
$cshowList :: [Directive] -> ShowS
showList :: [Directive] -> ShowS
Show)
data Value = Bool Bool
| String Text
| Number Scientific
| List [Value]
deriving (Value -> Value -> Bool
(Value -> Value -> Bool) -> (Value -> Value -> Bool) -> Eq Value
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Value -> Value -> Bool
== :: Value -> Value -> Bool
$c/= :: Value -> Value -> Bool
/= :: Value -> Value -> Bool
Eq, Int -> Value -> ShowS
[Value] -> ShowS
Value -> String
(Int -> Value -> ShowS)
-> (Value -> String) -> ([Value] -> ShowS) -> Show Value
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Value -> ShowS
showsPrec :: Int -> Value -> ShowS
$cshow :: Value -> String
show :: Value -> String
$cshowList :: [Value] -> ShowS
showList :: [Value] -> ShowS
Show)
data Interpolate = Literal Text
| Interpolate Text
deriving (Interpolate -> Interpolate -> Bool
(Interpolate -> Interpolate -> Bool)
-> (Interpolate -> Interpolate -> Bool) -> Eq Interpolate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Interpolate -> Interpolate -> Bool
== :: Interpolate -> Interpolate -> Bool
$c/= :: Interpolate -> Interpolate -> Bool
/= :: Interpolate -> Interpolate -> Bool
Eq, Int -> Interpolate -> ShowS
[Interpolate] -> ShowS
Interpolate -> String
(Int -> Interpolate -> ShowS)
-> (Interpolate -> String)
-> ([Interpolate] -> ShowS)
-> Show Interpolate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Interpolate -> ShowS
showsPrec :: Int -> Interpolate -> ShowS
$cshow :: Interpolate -> String
show :: Interpolate -> String
$cshowList :: [Interpolate] -> ShowS
showList :: [Interpolate] -> ShowS
Show)