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

13
Gap.hs
View File

@ -15,7 +15,6 @@ module Gap (
, fOptions
, toStringBuffer
, liftIO
, extensionToString
, showSeverityCaption
#if __GLASGOW_HASKELL__ >= 702
#else
@ -31,7 +30,6 @@ import ErrUtils
import FastString
import GHC
import GHCChoice
import Language.Haskell.Extension
import Outputable
import StringBuffer
@ -210,14 +208,3 @@ showSeverityCaption _ = ""
#else
showSeverityCaption = const ""
#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