From dd6ade19b32cc68ae99a82d0eeea104726396404 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Wed, 13 Feb 2013 14:18:24 +0900 Subject: [PATCH] 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. --- Cabal.hs | 8 +++----- Gap.hs | 13 ------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Cabal.hs b/Cabal.hs index a7f6e57..cc42c67 100644 --- a/Cabal.hs +++ b/Cabal.hs @@ -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" ++) ---------------------------------------------------------------- diff --git a/Gap.hs b/Gap.hs index 6f956a9..5757dfd 100644 --- a/Gap.hs +++ b/Gap.hs @@ -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