Using display instead of Gap.extensionToString.

eagletmt suggested that extensionToString is broken in GHC 7.6.* in #101.
We use 'display' as a right API.
This commit is contained in:
Kazu Yamamoto 2013-02-13 14:18:24 +09:00
parent 5b2ddde59e
commit dd6ade19b3
2 changed files with 3 additions and 18 deletions

View File

@ -9,11 +9,11 @@ import Control.Monad
import CoreMonad import CoreMonad
import Data.List import Data.List
import Distribution.PackageDescription (BuildInfo(..), usedExtensions) import Distribution.PackageDescription (BuildInfo(..), usedExtensions)
import Distribution.Text (display)
import ErrMsg import ErrMsg
import GHC import GHC
import GHCApi import GHCApi
import GHCChoice import GHCChoice
import qualified Gap
import System.Directory import System.Directory
import System.FilePath import System.FilePath
import Types import Types
@ -39,8 +39,8 @@ fromCabal ghcOptions = do
(owdir,cdir,cfile) <- getDirs (owdir,cdir,cfile) <- getDirs
cabal <- cabalParseFile cfile cabal <- cabalParseFile cfile
binfo@BuildInfo{..} <- cabalBuildInfo cabal binfo@BuildInfo{..} <- cabalBuildInfo cabal
let exts = map (addX . Gap.extensionToString) $ usedExtensions binfo let exts = map (("-X" ++) . display) $ usedExtensions binfo
lang = maybe "-XHaskell98" (addX . show) defaultLanguage lang = maybe "-XHaskell98" (("-X" ++) . display) defaultLanguage
libs = map ("-l" ++) extraLibs libs = map ("-l" ++) extraLibs
libDirs = map ("-L" ++) extraLibDirs libDirs = map ("-L" ++) extraLibDirs
gopts = ghcOptions ++ exts ++ [lang] ++ libs ++ libDirs gopts = ghcOptions ++ exts ++ [lang] ++ libs ++ libDirs
@ -49,8 +49,6 @@ fromCabal ghcOptions = do
dirs -> map (cdir </>) dirs ++ [owdir] dirs -> map (cdir </>) dirs ++ [owdir]
depPkgs <- cabalDependPackages cabal depPkgs <- cabalDependPackages cabal
return (gopts,idirs,depPkgs) return (gopts,idirs,depPkgs)
where
addX = ("-X" ++)
---------------------------------------------------------------- ----------------------------------------------------------------

13
Gap.hs
View File

@ -15,7 +15,6 @@ module Gap (
, fOptions , fOptions
, toStringBuffer , toStringBuffer
, liftIO , liftIO
, extensionToString
, showSeverityCaption , showSeverityCaption
#if __GLASGOW_HASKELL__ >= 702 #if __GLASGOW_HASKELL__ >= 702
#else #else
@ -31,7 +30,6 @@ import ErrUtils
import FastString import FastString
import GHC import GHC
import GHCChoice import GHCChoice
import Language.Haskell.Extension
import Outputable import Outputable
import StringBuffer import StringBuffer
@ -210,14 +208,3 @@ showSeverityCaption _ = ""
#else #else
showSeverityCaption = const "" showSeverityCaption = const ""
#endif #endif
----------------------------------------------------------------
-- This is Cabal, not GHC API
extensionToString :: Extension -> String
#if __GLASGOW_HASKELL__ == 704
extensionToString (EnableExtension ext) = show ext
extensionToString (DisableExtension ext) = show ext -- FIXME
extensionToString (UnknownExtension ext) = ext
#else
extensionToString = show
#endif