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

@ -1,7 +1,6 @@
{-# LANGUAGE CPP, BangPatterns, TupleSections, DeriveGeneric #-} {-# LANGUAGE CPP, BangPatterns, TupleSections, DeriveGeneric #-}
module GhcModExe.Find module GhcModExe.Find
#ifndef SPEC
( Symbol ( Symbol
, SymbolDb , SymbolDb
, loadSymbolDb , loadSymbolDb
@ -14,9 +13,7 @@ module GhcModExe.Find
, AsyncSymbolDb , AsyncSymbolDb
, newAsyncSymbolDb , newAsyncSymbolDb
, getAsyncSymbolDb , getAsyncSymbolDb
) ) where
#endif
where
import qualified GHC as G import qualified GHC as G
import FastString import FastString

View File

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

View File

@ -1,15 +1,14 @@
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP #-}
module Language.Haskell.GhcMod.Cradle module Language.Haskell.GhcMod.Cradle
#ifndef SPEC ( findCradle
(
findCradle
, findCradle' , findCradle'
, findCradleNoLog , findCradleNoLog
, findSpecCradle , findSpecCradle
, cleanupCradle , cleanupCradle
)
#endif -- * for @spec@
where , plainCradle
) where
import Language.Haskell.GhcMod.PathsAndFiles import Language.Haskell.GhcMod.PathsAndFiles
import Language.Haskell.GhcMod.Monad.Types 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 -- | Returns the path to the currently running ghc-mod executable. With ghc<7.6
-- this is a guess but >=7.6 uses 'getExecutablePath'. -- this is a guess but >=7.6 uses 'getExecutablePath'.
ghcModExecutable :: IO FilePath ghcModExecutable :: IO FilePath
#ifndef SPEC
ghcModExecutable = do ghcModExecutable = do
dir <- takeDirectory <$> getExecutablePath' exe <- getExecutablePath'
return $ (if dir == "." then "" else dir) </> "ghc-mod" stack <- lookupEnv "STACK_EXE"
#else case takeBaseName exe of
ghcModExecutable = do "spec" | Just _ <- stack ->
gpp <- lookupEnv "STACK_EXE" (</> "ghc-mod") <$> getBinDir
case gpp of "spec" ->
Just _ -> fmap (</> "ghc-mod") getBinDir (</> "dist/build/ghc-mod/ghc-mod") <$> getCurrentDirectory
_ -> fmap (</> "dist/build/ghc-mod/ghc-mod") getCurrentDirectory "ghc-mod" ->
#endif return exe
_ ->
return $ takeDirectory exe </> "ghc-mod"
getExecutablePath' :: IO FilePath getExecutablePath' :: IO FilePath
#if __GLASGOW_HASKELL__ >= 706 #if __GLASGOW_HASKELL__ >= 706

View File

@ -274,7 +274,6 @@ Test-Suite spec
Main-Is: Main.hs Main-Is: Main.hs
Hs-Source-Dirs: test, ., src, core Hs-Source-Dirs: test, ., src, core
Ghc-Options: -Wall -fno-warn-deprecations -threaded Ghc-Options: -Wall -fno-warn-deprecations -threaded
CPP-Options: -DSPEC=1
Type: exitcode-stdio-1.0 Type: exitcode-stdio-1.0
Other-Modules: Paths_ghc_mod Other-Modules: Paths_ghc_mod
Dir Dir