aboutsummaryrefslogtreecommitdiff
path: root/Data/ConfigManager/Types/Internal.hs
blob: 4459b010393413b2a019b4d0549037e22558e1df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module Data.ConfigManager.Types.Internal
  ( Config(..)
  , Expr(..)
  , Name
  , Value
  , Requirement(..)
  , Configured
  , convert
  ) where

import Data.Text (Text)
import Data.HashMap.Strict

-- | Configuration data.

data Config = Config
  { hashMap :: HashMap Name Value
  } deriving (Eq, Read, Show)

-- | An expression is either a binding or an import.

data Expr =
  Binding Name Value
  | Import Requirement FilePath
  deriving (Eq, Read, Show)

-- | A name is a text.

type Name = Text

-- | A value is a text.

type Value = Text

-- | A requirement is either required or optional.

data Requirement =
  Required
  | Optional
  deriving (Eq, Read, Show)

-- | This class represents types that can be converted /from/ a value /to/ a
-- destination type

class Configured a where
  convert :: Value -> Maybe a