aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime/Types.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-10-22 01:20:56 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-10-27 20:48:56 +0200
commit783eadafe6e6333123add96d2fc0276c8b4cc1d9 (patch)
treefe16786a713d727ab5975f9b1f0f852005308053 /src/CabalHelper/Compiletime/Types.hs
parent069225e2e61562c8166a446d201457425b91ce57 (diff)
Suport using Stack's built-in GHC to build the helper
Diffstat (limited to 'src/CabalHelper/Compiletime/Types.hs')
-rw-r--r--src/CabalHelper/Compiletime/Types.hs42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs
index cc8561f..5ae712a 100644
--- a/src/CabalHelper/Compiletime/Types.hs
+++ b/src/CabalHelper/Compiletime/Types.hs
@@ -101,7 +101,10 @@ data QueryEnvI cache (proj_type :: ProjType) = QueryEnv
-- processes. Useful if you need to, for example, redirect standard error
-- output away from the user\'s terminal.
- , qePrograms :: Programs
+ , qePrograms :: !Programs
+ -- ^ Field accessor for 'QueryEnv'.
+
+ , qeCompPrograms :: !CompPrograms
-- ^ Field accessor for 'QueryEnv'.
, qeProjLoc :: !(ProjLoc proj_type)
@@ -232,15 +235,16 @@ data StackProjPaths = StackProjPaths
{ sppGlobalPkgDb :: !PackageDbDir
, sppSnapPkgDb :: !PackageDbDir
, sppLocalPkgDb :: !PackageDbDir
+ , sppCompExe :: !FilePath
}
+
+-- Beware: GHC 8.0.2 doesn't like these being recursively defined for some
+-- reason so just keep them unrolled.
type Verbose = (?verbose :: Bool)
-type Progs = (?progs :: Programs)
--- TODO: rname to `CompEnv` or something
-type Env =
- ( ?verbose :: Bool
- , ?progs :: Programs
- )
+type Env = (?cprogs :: CompPrograms, ?progs :: Programs, ?verbose :: Bool)
+type Progs = (?cprogs :: CompPrograms, ?progs :: Programs)
+type CProgs = (?cprogs :: CompPrograms)
-- | Configurable paths to various programs we use.
data Programs = Programs {
@@ -248,21 +252,25 @@ data Programs = Programs {
cabalProgram :: FilePath,
-- | The path to the @stack@ program.
- stackProgram :: FilePath,
+ stackProgram :: FilePath
+ } deriving (Eq, Ord, Show, Read, Generic, Typeable)
- -- | The path to the @ghc@ program.
- ghcProgram :: FilePath,
+data CompPrograms = CompPrograms
+ { ghcProgram :: FilePath
+ -- ^ The path to the @ghc@ program.
- -- | The path to the @ghc-pkg@ program. If
- -- not changed it will be derived from the path to 'ghcProgram'.
- ghcPkgProgram :: FilePath
+ , ghcPkgProgram :: FilePath
+ -- ^ The path to the @ghc-pkg@ program. If not changed it will be derived
+ -- from the path to 'ghcProgram'.
} deriving (Eq, Ord, Show, Read, Generic, Typeable)
-- | By default all programs use their unqualified names, i.e. they will be
-- searched for on @PATH@.
defaultPrograms :: Programs
-defaultPrograms = Programs "cabal" "stack" "ghc" "ghc-pkg"
+defaultPrograms = Programs "cabal" "stack"
+defaultCompPrograms :: CompPrograms
+defaultCompPrograms = CompPrograms "ghc" "ghc-pkg"
data CompileOptions = CompileOptions
{ oVerbose :: Bool
@@ -274,12 +282,6 @@ data CompileOptions = CompileOptions
oCabalProgram :: Env => FilePath
oCabalProgram = cabalProgram ?progs
-oGhcProgram :: Env => FilePath
-oGhcProgram = ghcProgram ?progs
-
-oGhcPkgProgram :: Env => FilePath
-oGhcPkgProgram = ghcPkgProgram ?progs
-
defaultCompileOptions :: CompileOptions
defaultCompileOptions =
CompileOptions False Nothing Nothing defaultPrograms