Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Remove 'SPEC' ifdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielG committed Jan 12, 2017
1 parent 07fb011 commit fa761df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
5 changes: 1 addition & 4 deletions GhcMod/Find.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE CPP, BangPatterns, TupleSections, DeriveGeneric #-}

module GhcMod.Find
#ifndef SPEC
( Symbol
, SymbolDb
, loadSymbolDb
Expand All @@ -14,9 +13,7 @@ module GhcMod.Find
, AsyncSymbolDb
, newAsyncSymbolDb
, getAsyncSymbolDb
)
#endif
where
) where

import qualified GHC as G
import FastString
Expand Down
21 changes: 11 additions & 10 deletions core/Language/Haskell/GhcMod/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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-real/ghc-mod-real") <$> getCurrentDirectory
"ghc-mod-real" ->
return exe
_ ->
return $ takeDirectory exe </> "ghc-mod"

getExecutablePath' :: IO FilePath
#if __GLASGOW_HASKELL__ >= 706
Expand Down
1 change: 0 additions & 1 deletion ghc-mod.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ Test-Suite spec
Main-Is: Main.hs
Hs-Source-Dirs: test, src
Ghc-Options: -Wall -fno-warn-deprecations -threaded
CPP-Options: -DSPEC=1
Type: exitcode-stdio-1.0
Other-Modules: Paths_ghc_mod
Dir
Expand Down

0 comments on commit fa761df

Please sign in to comment.