1{-# LANGUAGE InstanceSigs #-}23-- | Core types for the scfg configuration file format.4module Data.Scfg.Types (5 Directive (..),6 Config,7 ParseError (..),8) where910import Control.Exception (Exception (..))11import Data.Text (Text)12import qualified Data.Text as T1314{- | A directive: a name, zero or more parameteres, and zero or more15child directives.16-}17data Directive = Directive18 { directiveName :: Text19 , directiveParams :: [Text]20 , directiveChildren :: [Directive]21 }22 deriving (Show, Eq)2324-- | A parsed scfg configuration: a list of top-level directives.25type Config = [Directive]2627-- | An error that occurred while parsing a scfg configuration.28data ParseError = ParseError29 { errorLine :: Int30 -- ^ Line number of parse error31 , errorColumn :: Int32 -- ^ Column number of parse error33 , errorMessage :: Text34 -- ^ Human-readable error message describing the parse error35 }36 deriving (Show, Eq)3738instance Exception ParseError where39 displayException :: ParseError -> String40 displayException = T.unpack . errorMessage