Remove 'SPEC' ifdefs

This commit is contained in:
Daniel Gröber
2017-01-12 17:03:31 +01:00
parent 4a6aeadfc1
commit 37f61fb9c6
5 changed files with 19 additions and 25 deletions

View File

@@ -16,15 +16,13 @@
{-# LANGUAGE CPP #-}
module Language.Haskell.GhcMod.CabalHelper
#ifndef SPEC
( getComponents
, getGhcMergedPkgOptions
, getCabalPackageDbStack
, prepareCabalHelper
, withAutogen
)
#endif
where
, withCabal
) where
import Control.Applicative
import Control.Monad

View File

@@ -1,15 +1,14 @@
{-# LANGUAGE CPP #-}
module Language.Haskell.GhcMod.Cradle
#ifndef SPEC
(
findCradle
( findCradle
, findCradle'
, findCradleNoLog
, findSpecCradle
, cleanupCradle
)
#endif
where
-- * for @spec@
, plainCradle
) where
import Language.Haskell.GhcMod.PathsAndFiles
import Language.Haskell.GhcMod.Monad.Types

View File

@@ -79,17 +79,18 @@ whenM mb ma = mb >>= flip when ma
-- | Returns the path to the currently running ghc-mod executable. With ghc<7.6
-- this is a guess but >=7.6 uses 'getExecutablePath'.
ghcModExecutable :: IO FilePath
#ifndef SPEC
ghcModExecutable = do
dir <- takeDirectory <$> getExecutablePath'
return $ (if dir == "." then "" else dir) </> "ghc-mod"
#else
ghcModExecutable = do
gpp <- lookupEnv "STACK_EXE"
case gpp of
Just _ -> fmap (</> "ghc-mod") getBinDir
_ -> fmap (</> "dist/build/ghc-mod/ghc-mod") getCurrentDirectory
#endif
exe <- getExecutablePath'
stack <- lookupEnv "STACK_EXE"
case takeBaseName exe of
"spec" | Just _ <- stack ->
(</> "ghc-mod") <$> getBinDir
"spec" ->
(</> "dist/build/ghc-mod/ghc-mod") <$> getCurrentDirectory
"ghc-mod" ->
return exe
_ ->
return $ takeDirectory exe </> "ghc-mod"
getExecutablePath' :: IO FilePath
#if __GLASGOW_HASKELL__ >= 706