aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CabalHelper/Compiletime/Types.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs
index b30e107..748b8d1 100644
--- a/src/CabalHelper/Compiletime/Types.hs
+++ b/src/CabalHelper/Compiletime/Types.hs
@@ -32,6 +32,7 @@ import Data.IORef
import Data.Version
import Data.Typeable
import GHC.Generics
+import System.FilePath (takeDirectory)
import System.Posix.Types
import CabalHelper.Compiletime.Types.RelativePath
import CabalHelper.Shared.InterfaceTypes
@@ -146,7 +147,7 @@ data ProjLoc (pt :: ProjType) where
-- configuration file then points to the packages that make up this
-- project. This corresponds to the @--cabal-project=PATH@ flag on the
-- @cabal@ command line.
- ProjLocV2File :: { plCabalProjectFile :: !FilePath } -> ProjLoc ('Cabal 'CV2)
+ ProjLocV2File :: { plCabalProjectFile :: !FilePath, plProjectDirV2 :: !FilePath } -> ProjLoc ('Cabal 'CV2)
-- | This is equivalent to 'ProjLocV2File' but using the default
-- @cabal.project@ file name.
@@ -164,6 +165,15 @@ plV1Dir :: ProjLoc ('Cabal 'CV1) -> FilePath
plV1Dir ProjLocV1CabalFile {plProjectDirV1} = plProjectDirV1
plV1Dir ProjLocV1Dir {plProjectDirV1} = plProjectDirV1
+plCabalProjectDir :: ProjLoc ('Cabal cpt) -> FilePath
+plCabalProjectDir ProjLocV1CabalFile {plProjectDirV1} = plProjectDirV1
+plCabalProjectDir ProjLocV1Dir {plProjectDirV1} = plProjectDirV1
+plCabalProjectDir ProjLocV2File {plProjectDirV2} = plProjectDirV2
+plCabalProjectDir ProjLocV2Dir {plProjectDirV2} = plProjectDirV2
+
+plStackProjectDir :: ProjLoc 'Stack -> FilePath
+plStackProjectDir ProjLocStackYaml {plStackYaml} = takeDirectory plStackYaml
+
projTypeOfProjLoc :: ProjLoc pt -> SProjType pt
projTypeOfProjLoc ProjLocV1CabalFile{} = SCabal SCV1
projTypeOfProjLoc ProjLocV1Dir{} = SCabal SCV1