{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveDataTypeable #-}
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(x,y,z) 1
#endif
module Config.Value
( Section(..)
, Value(..)
, Atom(..)
) where
import Data.Text (Text)
import Data.Data (Data, Typeable)
import Data.String (IsString(..))
#if MIN_VERSION_base(4,6,0)
import GHC.Generics (Generic)
#endif
data Section = Section
{ sectionName :: Text
, sectionValue :: Value
}
deriving (Eq, Read, Show, Typeable, Data
#if MIN_VERSION_base(4,6,0)
, Generic
#endif
)
newtype Atom = MkAtom { atomName :: Text }
deriving (Eq, Ord, Show, Read, Typeable, Data
#if MIN_VERSION_base(4,6,0)
, Generic
#endif
)
instance IsString Atom where
fromString = MkAtom . fromString
data Value
= Sections [Section]
| Number Int Integer
| Floating Integer Integer
| Text Text
| Atom Atom
| List [Value]
deriving (Eq, Read, Show, Typeable, Data
#if MIN_VERSION_base(4,6,0)
, Generic
#endif
)