module CabalHelper.Types where
import GHC.Generics
import Data.Version
newtype ChModuleName = ChModuleName String
deriving (Eq, Ord, Read, Show, Generic)
data ChComponentName = ChSetupHsName
| ChLibName String
| ChExeName String
| ChTestName String
| ChBenchName String
deriving (Eq, Ord, Read, Show, Generic)
data ChResponse
= ChResponseCompList [(ChComponentName, [String])]
| ChResponseEntrypoints [(ChComponentName, ChEntrypoint)]
| ChResponseList [String]
| ChResponsePkgDbs [ChPkgDb]
| ChResponseLbi String
| ChResponseVersion String Version
| ChResponseLicenses [(String, [(String, Version)])]
| ChResponseFlags [(String, Bool)]
deriving (Eq, Ord, Read, Show, Generic)
data ChEntrypoint = ChSetupEntrypoint
| ChLibEntrypoint { chExposedModules :: [ChModuleName]
, chOtherModules :: [ChModuleName]
}
| ChExeEntrypoint { chMainIs :: FilePath
, chOtherModules :: [ChModuleName]
} deriving (Eq, Ord, Read, Show, Generic)
data ChPkgDb = ChPkgGlobal
| ChPkgUser
| ChPkgSpecific FilePath
deriving (Eq, Ord, Read, Show, Generic)
data Options = Options {
verbose :: Bool
, ghcProgram :: FilePath
, ghcPkgProgram :: FilePath
, cabalProgram :: FilePath
, cabalVersion :: Maybe Version
, cabalPkgDb :: Maybe FilePath
}
defaultOptions :: Options
defaultOptions = Options False "ghc" "ghc-pkg" "cabal" Nothing Nothing