module Precis.Cabal.Datatypes
(
Package(..)
, CabalFileError(..)
, cabalFileErrorMsg
, HsSourceFile(..)
, hsSourceFile
, UnresolvedModule(..)
) where
import Precis.Cabal.InterimDatatypes
import qualified System.FilePath as FP
data Package = Package
{ package_name :: String
, package_version :: String
, exposed_modules :: [HsSourceFile]
, internal_modules :: [HsSourceFile]
, unresolved_modules :: [UnresolvedModule]
}
deriving (Eq,Show)
data CabalFileError = ERR_CABAL_FILE_MISSING FilePath
| ERR_CABAL_FILE_PARSE String
deriving (Eq,Show)
cabalFileErrorMsg :: CabalFileError -> String
cabalFileErrorMsg (ERR_CABAL_FILE_MISSING s) = "*** Error: missing file - " ++ s
cabalFileErrorMsg (ERR_CABAL_FILE_PARSE s) = "*** Error: parse error - " ++ s
data HsSourceFile = HsSourceFile
{ module_name :: ModName
, full_path_to :: FilePath
}
deriving (Eq,Ord,Show)
newtype UnresolvedModule = UnresolvedModule { unresolved_name :: ModName }
deriving (Eq,Ord,Show)
hsSourceFile :: ModName -> FilePath -> HsSourceFile
hsSourceFile name path = HsSourceFile name (FP.normalise path)