blob: 0855117635b2b2e3de5b615ab173545f84eea78b (
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
|
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE IncoherentInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.ConfigManager.Instances
() where
import qualified Data.Text as T
import Data.Time.Clock (DiffTime, NominalDiffTime)
import Text.Read (readMaybe)
import Data.ConfigManager.Types.Internal
import Data.ConfigManager.Parser.Duration (parseDuration)
instance Configured DiffTime where
convert value = parseDuration value
instance Configured NominalDiffTime where
convert value = realToFrac <$> parseDuration value
instance Read a => Configured a where
convert = readMaybe . T.unpack
|