blob: ecfa20d62f8e9d03cb72d53390403c91bb2aea16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
module Conftrack.Source (ConfigSource(..), SomeSource(..)) where
import Conftrack.Value (Key, Value(..), ConfigError(..))
import Control.Monad.State (StateT (..))
import Data.Text (Text)
class ConfigSource s where
type SourceState s
fetchValue :: Key -> s -> StateT (SourceState s) IO (Either ConfigError (Value, Text))
leftovers :: s -> StateT (SourceState s) IO (Maybe [Key])
data SomeSource = forall source. ConfigSource source
=> SomeSource (source, SourceState source)
|