[Pkg-haskell-commits] darcs: haskell-leksah-server: Add forgotten patch

Iain Lane laney at debian.org
Sun Apr 14 10:11:07 UTC 2013


Sun Apr 14 10:10:57 UTC 2013  Iain Lane <laney at debian.org>
  * Add forgotten patch
  Ignore-this: 49b9b6a82bf6e5195b2f6d9bbbe0264c

    A ./patches/ghc-7.6-compatibility.patch

Sun Apr 14 10:10:57 UTC 2013  Iain Lane <laney at debian.org>
  * Add forgotten patch
  Ignore-this: 49b9b6a82bf6e5195b2f6d9bbbe0264c
diff -rN -u old-haskell-leksah-server//patches/ghc-7.6-compatibility.patch new-haskell-leksah-server//patches/ghc-7.6-compatibility.patch
--- old-haskell-leksah-server//patches/ghc-7.6-compatibility.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-leksah-server//patches/ghc-7.6-compatibility.patch	2013-04-14 10:11:07.097524517 +0000
@@ -0,0 +1,1846 @@
+From dc892c956ce07b3386778fc1fe7597adb9f8505b Mon Sep 17 00:00:00 2001
+From: Hamish Mackenzie <Hamish.K.Mackenzie at googlemail.com>
+Date: Wed, 10 Oct 2012 17:24:49 +1300
+Subject: [PATCH] GHC 7.6 fixes (Iain Lane: slightly modified for Debian)
+
+---
+ leksah-server.cabal                    |  44 +++---
+ src/IDE/Core/CTypes.hs                 |   2 +
+ src/IDE/HeaderParser.hs                |  50 +++---
+ src/IDE/Metainfo/InterfaceCollector.hs | 122 +++++++++------
+ src/IDE/Metainfo/PackageCollector.hs   |  13 +-
+ src/IDE/Metainfo/SourceCollectorH.hs   | 271 ++++++++++++++++++++-------------
+ src/IDE/Metainfo/WorkspaceCollector.hs | 228 +++++++++++++++++----------
+ src/IDE/Utils/FileUtils.hs             |  41 ++---
+ src/IDE/Utils/GHCUtils.hs              |  38 ++++-
+ src/IDE/Utils/Server.hs                |   9 +-
+ src/IDE/Utils/VersionUtils.hs          |   9 +-
+ 11 files changed, 519 insertions(+), 308 deletions(-)
+
+Index: b/leksah-server.cabal
+===================================================================
+--- a/leksah-server.cabal
++++ b/leksah-server.cabal
+@@ -32,22 +32,25 @@
+ 
+ library
+     default-language: Haskell98
+-    build-depends: Cabal >=1.6.0.1 && <1.15, base >= 4.0.0.0 && <4.6, binary >=0.5.0.0 && <0.6,
+-               binary-shared >=0.8 && <0.9, bytestring >=0.9.0.1 && <0.10,
+-               containers >=0.2.0.0 && <0.5,
+-               directory >=1.0.0.2 && <1.2, filepath >=1.1.0.1 && <1.4, ghc >=6.10.1 && <7.5,
++    build-depends: Cabal >=1.6.0.1 && <1.17, base >= 4.0.0.0 && <4.7, binary >=0.5.0.0 && <0.6,
++               binary-shared >=0.8 && <0.9, bytestring >=0.9.0.1 && <0.11,
++               containers >=0.2.0.0 && <0.6,
++               directory >=1.0.0.2 && <1.3, filepath >=1.1.0.1 && <1.4, ghc >=6.10.1 && <7.7,
+                ltk >=0.12.1.0 && <0.13, parsec >=2.1.0.1 && <3.2,
+                pretty >=1.0.1.0 && <1.2, time >=1.1 && <1.5, deepseq >=1.1 && <1.4,
+-               hslogger >= 1.0.7 && <1.2, network >=2.2 && <3.0, enumerator >=0.4.14 && < 0.5,
++               hslogger >= 1.0.7 && <1.3, network >=2.2 && <3.0, enumerator >=0.4.14 && < 0.5,
+                attoparsec-enumerator >=0.3 && <0.4, attoparsec >=0.10.0.3 && <0.11,
+                transformers >=0.2.2.0 && <0.4, strict >=0.3.2 && <0.4
+ 
+     if (impl(ghc >= 7.2))
+         binary-shared >=0.8.2
+ 
+-    if (impl(ghc >= 7.4))
+-       build-depends: haddock >= 2.7.2 && <2.11
++    if (impl(ghc >= 7.6))
++       build-depends: haddock >= 2.7.2 && <2.14
+     else
++     if (impl(ghc >= 7.4))
++        build-depends: haddock >= 2.7.2 && <2.11
++     else
+        if (impl(ghc >= 7.2))
+           build-depends: haddock >= 2.7.2 && <2.10
+        else
+@@ -68,7 +71,7 @@
+         build-depends: Win32 >=2.2.0.0 && <2.3
+         extra-libraries: kernel32  pango-1.0 glib-2.0
+     else
+-        build-depends: unix >=2.3.1.0 && <2.6
++        build-depends: unix >=2.3.1.0 && <2.7
+ 
+     if flag(curl) || os(osx)
+         cpp-options: -DUSE_CURL
+@@ -96,18 +99,21 @@
+ 
+ executable leksah-server
+     default-language: Haskell98
+-    build-depends: Cabal >=1.6.0.1 && <1.15, base >= 4.0.0.0 && <4.6, binary >=0.5.0.0 && <0.6,
+-               binary-shared >=0.8 && <0.9, bytestring >=0.9.0.1 && <0.10,
+-               containers >=0.2.0.0 && <0.5,
+-               directory >=1.0.0.2 && <1.2, filepath >=1.1.0.1 && <1.6, ghc >=6.10.1 && <7.5,
++    build-depends: Cabal >=1.6.0.1 && <1.17, base >= 4.0.0.0 && <4.7, binary >=0.5.0.0 && <0.6,
++               binary-shared >=0.8 && <0.9, bytestring >=0.9.0.1 && <0.11,
++               containers >=0.2.0.0 && <0.6,
++               directory >=1.0.0.2 && <1.3, filepath >=1.1.0.1 && <1.6, ghc >=6.10.1 && <7.7,
+                ltk >=0.12.1.0 && <0.13, parsec >=2.1.0.1 && <3.2,
+                pretty >=1.0.1.0 && <1.2, time >=1.1 && <1.5, deepseq >=1.1 && <1.4,
+-               hslogger >= 1.0.7 && <1.2, network >=2.2 && <3.0, enumerator >= 0.4.14 && <0.5,
++               hslogger >= 1.0.7 && <1.3, network >=2.2 && <3.0, enumerator >= 0.4.14 && <0.5,
+                attoparsec-enumerator >=0.3 && <0.4, attoparsec >=0.10.0.3 && <0.11,
+                transformers >=0.2.2.0 && <0.4, strict >=0.3.2 && <0.4
+-    if (impl(ghc >= 7.4))
+-       build-depends: haddock >= 2.7.2 && <2.11
++    if (impl(ghc >= 7.6))
++       build-depends: haddock >= 2.7.2 && <2.14
+     else
++     if (impl(ghc >= 7.4))
++        build-depends: haddock >= 2.7.2 && <2.11
++     else
+        if (impl(ghc >= 7.2))
+           build-depends: haddock >= 2.7.2 && <2.10
+        else
+@@ -128,7 +134,7 @@
+         build-depends: Win32 >=2.2.0.0 && <2.3
+         extra-libraries: kernel32 pango-1.0 glib-2.0
+     else
+-        build-depends: unix >=2.3.1.0 && <2.6
++        build-depends: unix >=2.3.1.0 && <2.7
+ 
+     if flag(curl) || os(osx)
+         cpp-options: -DUSE_CURL
+@@ -167,8 +173,8 @@
+     hs-source-dirs: src
+     ghc-prof-options: -auto-all -prof
+ --    ghc-shared-options: -auto-all -prof
+-    build-depends:  base >= 4.0.0.0 && <4.6, hslogger >= 1.0.7 && <1.2, deepseq >=1.1 && <1.4,
+-               bytestring >=0.9.0.1 && <0.10, enumerator >= 0.4.14 && <0.5,
++    build-depends:  base >= 4.0.0.0 && <4.7, hslogger >= 1.0.7 && <1.3, deepseq >=1.1 && <1.4,
++               bytestring >=0.9.0.1 && <0.11, enumerator >= 0.4.14 && <0.5,
+                attoparsec-enumerator >=0.3 && <0.4, attoparsec >=0.10.0.3 && <0.11,
+                transformers >=0.2.2.0 && <0.4
+ 
+@@ -190,7 +196,7 @@
+     type:       exitcode-stdio-1.0
+     hs-source-dirs: tests
+     main-is:    TestTool.hs
+-    build-depends: base >= 4.0.0.0 && <4.6,  hslogger >= 1.0.7 && <1.3,
++    build-depends: base >= 4.0.0.0 && <4.7,  hslogger >= 1.0.7 && <1.3,
+                leksah-server,
+                HUnit >=1.2 && <1.3, transformers >=0.2.2.0 && <0.4, enumerator >=0.4.14 && <0.5
+ 
+Index: b/src/IDE/Core/CTypes.hs
+===================================================================
+--- a/src/IDE/Core/CTypes.hs
++++ b/src/IDE/Core/CTypes.hs
+@@ -542,7 +542,9 @@
+ 
+ instance NFData DescrType where  rnf a = seq a ()
+ 
++#if !MIN_VERSION_bytestring(0,10,0)
+ instance NFData BS.ByteString where  rnf b = seq b ()
++#endif
+ 
+ #if !MIN_VERSION_deepseq(1,3,0)
+ instance NFData Version where  rnf v = seq v ()
+Index: b/src/IDE/HeaderParser.hs
+===================================================================
+--- a/src/IDE/HeaderParser.hs
++++ b/src/IDE/HeaderParser.hs
+@@ -21,17 +21,31 @@
+ import IDE.Core.CTypes hiding(SrcSpan(..))
+ import GHC hiding (ImportDecl)
+ import FastString(unpackFS)
+-import RdrName(showRdrName)
+ import IDE.Utils.GHCUtils
+ import Data.Maybe (mapMaybe)
+ #if MIN_VERSION_ghc(7,4,1)
+-import Outputable(pprPrefixOcc,showSDoc)
++import Outputable(pprPrefixOcc, ppr)
+ #else
+-import Outputable(pprHsVar,showSDoc)
++import Outputable(pprHsVar, ppr)
++#endif
++#if MIN_VERSION_ghc(7,6,0)
++import Outputable(showSDoc)
++#else
++import qualified Outputable as O
+ #endif
+ import IDE.Utils.FileUtils (figureOutHaddockOpts)
+ import Control.Monad.IO.Class (MonadIO(..))
+ 
++#if !MIN_VERSION_ghc(7,6,0)
++showSDoc :: DynFlags -> O.SDoc -> String
++showSDoc _ = O.showSDoc
++showSDocUnqual :: DynFlags -> O.SDoc -> String
++showSDocUnqual _ = O.showSDocUnqual
++#endif
++
++showRdrName :: DynFlags -> RdrName -> String
++showRdrName dflags r = showSDoc dflags (ppr r)
++
+ parseTheHeader :: FilePath -> IO ServerAnswer
+ parseTheHeader filePath = do
+     text        <- readFile filePath
+@@ -39,7 +53,7 @@
+     parseResult <- liftIO $ myParseHeader filePath text opts
+     case parseResult of
+         Left str                                      -> return (ServerFailed str)
+-        Right (pr at HsModule{ hsmodImports = []})       -> do
++        Right (_, pr at HsModule{ hsmodImports = []})       -> do
+             let i = case hsmodDecls pr of
+                         decls@(_hd:_tl) -> (foldl (\ a b -> min a (srcSpanStartLine' (getLoc b))) 0 decls) - 1
+                         [] -> case hsmodExports pr of
+@@ -48,13 +62,13 @@
+                                         Nothing -> 0
+                                         Just mn -> srcSpanEndLine' (getLoc mn) + 2
+             return (ServerHeader (Right i))
+-        Right (_pr at HsModule{ hsmodImports = imports }) -> return (ServerHeader (Left (transformImports imports)))
++        Right (dflags, _pr at HsModule{ hsmodImports = imports }) -> return (ServerHeader (Left (transformImports dflags imports)))
+ 
+-transformImports :: [LImportDecl RdrName] -> [ImportDecl]
+-transformImports = map transformImport
++transformImports :: DynFlags -> [LImportDecl RdrName] -> [ImportDecl]
++transformImports dflags = map (transformImport dflags)
+ 
+-transformImport ::  LImportDecl RdrName -> ImportDecl
+-transformImport (L srcSpan importDecl) =
++transformImport :: DynFlags -> LImportDecl RdrName -> ImportDecl
++transformImport dflags (L srcSpan importDecl) =
+     ImportDecl {
+         importLoc = srcSpanToLocation srcSpan,
+         importModule = modName,
+@@ -73,19 +87,19 @@
+                         Just mn -> Just (moduleNameString mn)
+         specs =    case ideclHiding importDecl of
+                         Nothing -> Nothing
+-                        Just (hide, list) -> Just (ImportSpecList hide (mapMaybe transformEntity list))
++                        Just (hide, list) -> Just (ImportSpecList hide (mapMaybe (transformEntity dflags) list))
+ 
+-transformEntity :: LIE RdrName -> Maybe ImportSpec
++transformEntity :: DynFlags -> LIE RdrName -> Maybe ImportSpec
+ #if MIN_VERSION_ghc(7,2,0)
+-transformEntity (L _ (IEVar name))              = Just (IVar (showSDoc (pprPrefixOcc name)))
++transformEntity dflags (L _ (IEVar name))              = Just (IVar (showSDoc dflags (pprPrefixOcc name)))
+ #else
+-transformEntity (L _ (IEVar name))              = Just (IVar (showSDoc (pprHsVar name)))
++transformEntity dflags (L _ (IEVar name))              = Just (IVar (showSDoc dflags (pprHsVar name)))
+ #endif
+-transformEntity (L _ (IEThingAbs name))         = Just (IAbs (showRdrName name))
+-transformEntity (L _ (IEThingAll name))         = Just (IThingAll (showRdrName name))	
+-transformEntity (L _ (IEThingWith name list))   = Just (IThingWith (showRdrName name)
+-                                                        (map showRdrName list))	
+-transformEntity  _                              = Nothing
++transformEntity dflags (L _ (IEThingAbs name))         = Just (IAbs (showRdrName dflags name))
++transformEntity dflags (L _ (IEThingAll name))         = Just (IThingAll (showRdrName dflags name))	
++transformEntity dflags (L _ (IEThingWith name list))   = Just (IThingWith (showRdrName dflags name)
++                                                        (map (showRdrName dflags) list))	
++transformEntity _ _                              = Nothing
+ 
+ #if MIN_VERSION_ghc(7,2,0)
+ srcSpanToLocation :: SrcSpan -> Location
+Index: b/src/IDE/Metainfo/InterfaceCollector.hs
+===================================================================
+--- a/src/IDE/Metainfo/InterfaceCollector.hs
++++ b/src/IDE/Metainfo/InterfaceCollector.hs
+@@ -23,6 +23,7 @@
+ import Module hiding (PackageId,ModuleName)
+ import qualified Module as Module (ModuleName)
+ import qualified Maybes as M
++import DynFlags (DynFlags)
+ #if MIN_VERSION_ghc(7,2,0)
+ import HscTypes
+ import GhcMonad hiding (liftIO)
+@@ -36,7 +37,12 @@
+ import TysWiredIn ( eqTyConName )
+ #endif
+ import LoadIface
++#if MIN_VERSION_ghc(7,6,0)
+ import Outputable hiding(trace)
++#else
++import Outputable hiding(trace, showSDoc, showSDocUnqual)
++import qualified Outputable as O
++#endif
+ import IfaceSyn
+ import FastString
+ import Name
+@@ -65,15 +71,21 @@
+ import IDE.Utils.GHCUtils
+ import Control.DeepSeq(deepseq)
+ 
++#if !MIN_VERSION_ghc(7,6,0)
++showSDoc :: DynFlags -> SDoc -> String
++showSDoc _ = O.showSDoc
++showSDocUnqual :: DynFlags -> SDoc -> String
++showSDocUnqual _ = O.showSDocUnqual
++#endif
+ 
+ collectPackageFromHI :: PackageConfig -> IO PackageDescr
+-collectPackageFromHI  packageConfig = inGhcIO [] [] $ \ _ -> do
++collectPackageFromHI  packageConfig = inGhcIO [] [] $ \ dflags -> do
+     session             <-  getSession
+     exportedIfaceInfos  <-  getIFaceInfos (getThisPackage packageConfig)
+                                             (IPI.exposedModules packageConfig) session
+     hiddenIfaceInfos    <-  getIFaceInfos (getThisPackage packageConfig)
+                                             (IPI.hiddenModules packageConfig) session
+-    let pd = extractInfo exportedIfaceInfos hiddenIfaceInfos (getThisPackage packageConfig)
++    let pd = extractInfo dflags exportedIfaceInfos hiddenIfaceInfos (getThisPackage packageConfig)
+ #if MIN_VERSION_Cabal(1,8,0)
+                                             [] -- TODO 6.12 (IPI.depends $ packageConfigToInstalledPackageInfo packageConfig))
+ #else
+@@ -101,20 +113,20 @@
+ 
+ -------------------------------------------------------------------------
+ 
+-extractInfo :: [(ModIface, FilePath)] -> [(ModIface, FilePath)] -> PackageIdentifier ->
++extractInfo :: DynFlags -> [(ModIface, FilePath)] -> [(ModIface, FilePath)] -> PackageIdentifier ->
+                     [PackageIdentifier] -> PackageDescr
+-extractInfo  ifacesExp ifacesHid pid buildDepends =
+-    let allDescrs           =   concatMap (extractExportedDescrH pid)
++extractInfo dflags ifacesExp ifacesHid pid buildDepends =
++    let allDescrs           =   concatMap (extractExportedDescrH dflags pid)
+                                     (map fst (ifacesHid ++ ifacesExp))
+-        mods                =   map (extractExportedDescrR pid allDescrs) (map fst ifacesExp)
++        mods                =   map (extractExportedDescrR dflags pid allDescrs) (map fst ifacesExp)
+     in PackageDescr {
+         pdPackage           =   pid
+     ,   pdModules           =   mods
+     ,   pdBuildDepends      =   buildDepends
+     ,   pdMbSourcePath      =   Nothing}
+ 
+-extractExportedDescrH :: PackageIdentifier -> ModIface -> [Descr]
+-extractExportedDescrH pid iface =
++extractExportedDescrH :: DynFlags -> PackageIdentifier -> ModIface -> [Descr]
++extractExportedDescrH dflags pid iface =
+     let mid                 =   (fromJust . simpleParse . moduleNameString . moduleName) (mi_module iface)
+         exportedNames       =   Set.fromList
+ #if MIN_VERSION_Cabal(1,11,0)
+@@ -129,14 +141,15 @@
+         exportedDecls       =   filter (\ ifdecl -> (occNameString $ ifName ifdecl)
+                                                     `Set.member` exportedNames)
+                                                             (map snd (mi_decls iface))
+-    in  concatMap (extractIdentifierDescr pid [mid]) exportedDecls
++    in  concatMap (extractIdentifierDescr dflags pid [mid]) exportedDecls
+ 
+ 
+-extractExportedDescrR :: PackageIdentifier
++extractExportedDescrR :: DynFlags
++    -> PackageIdentifier
+     -> [Descr]
+     -> ModIface
+     -> ModuleDescr
+-extractExportedDescrR pid hidden iface =
++extractExportedDescrR dflags pid hidden iface =
+     let mid             =   (fromJust . simpleParse . moduleNameString . moduleName) (mi_module iface)
+         exportedNames   =   Set.fromList
+ #if MIN_VERSION_Cabal(1,11,0)
+@@ -151,12 +164,12 @@
+         exportedDecls   =   filter (\ ifdecl -> (occNameString $ifName ifdecl)
+                                                     `Set.member` exportedNames)
+                                                             (map snd (mi_decls iface))
+-        ownDecls        =   concatMap (extractIdentifierDescr pid [mid]) exportedDecls
++        ownDecls        =   concatMap (extractIdentifierDescr dflags pid [mid]) exportedDecls
+         otherDecls      =   exportedNames `Set.difference` (Set.fromList (map dscName ownDecls))
+         reexported      =   map (\d -> Reexported (ReexportedDescr (Just (PM pid mid)) d))
+                                  $ filter (\k -> (dscName k) `Set.member` otherDecls) hidden
+-        inst            =   concatMap (extractInstances (PM pid mid)) (mi_insts iface)
+-        uses            =   Map.fromList . catMaybes $ map extractUsages (mi_usages iface)
++        inst            =   concatMap (extractInstances dflags (PM pid mid)) (mi_insts iface)
++        uses            =   Map.fromList . catMaybes $ map (extractUsages dflags) (mi_usages iface)
+         declsWithExp    =   map withExp ownDecls
+         withExp (Real d) =  Real $ d{dscExported' = Set.member (dscName' d) exportedNames}
+         withExp _        =  error "Unexpected Reexported"
+@@ -166,14 +179,14 @@
+                 ,   mdReferences        =   uses
+                 ,   mdIdDescriptions    =   declsWithExp ++ inst ++ reexported}
+ 
+-extractIdentifierDescr :: PackageIdentifier -> [ModuleName] -> IfaceDecl -> [Descr]
+-extractIdentifierDescr package modules decl
++extractIdentifierDescr :: DynFlags -> PackageIdentifier -> [ModuleName] -> IfaceDecl -> [Descr]
++extractIdentifierDescr dflags package modules decl
+    = if null modules
+       then []
+       else
+         let descr = RealDescr{
+                     dscName'           =   unpackFS $occNameFS (ifName decl)
+-                ,   dscMbTypeStr'      =   Just (BS.pack $ unlines $ nonEmptyLines $ filterExtras $ showSDocUnqual $ppr decl)
++                ,   dscMbTypeStr'      =   Just (BS.pack $ unlines $ nonEmptyLines $ filterExtras $ showSDocUnqual dflags $ppr decl)
+                 ,   dscMbModu'         =   Just (PM package (last modules))
+                 ,   dscMbLocation'     =   Nothing
+                 ,   dscMbComment'      =   Nothing
+@@ -188,20 +201,20 @@
+ #endif
+                 -> map Real [descr]
+ #if MIN_VERSION_Cabal(1,11,0)
+-            (IfaceData name _ _ ifCons' _ _ _)
++            (IfaceData {ifName=name, ifCons=ifCons'})
+ #else
+             (IfaceData name _ _ ifCons' _ _ _ _)
+ #endif
+                 -> let d = case ifCons' of
+                             IfDataTyCon _decls
+                                 ->  let
+-                                        fieldNames          =   concatMap extractFields (visibleIfConDecls ifCons')
+-                                        constructors'       =   extractConstructors name (visibleIfConDecls ifCons')
++                                        fieldNames          =   concatMap (extractFields dflags) (visibleIfConDecls ifCons')
++                                        constructors'       =   extractConstructors dflags name (visibleIfConDecls ifCons')
+                                     in DataDescr constructors' fieldNames
+                             IfNewTyCon _
+                                 ->  let
+-                                        fieldNames          =   concatMap extractFields (visibleIfConDecls ifCons')
+-                                        constructors'       =   extractConstructors name (visibleIfConDecls ifCons')
++                                        fieldNames          =   concatMap (extractFields dflags) (visibleIfConDecls ifCons')
++                                        constructors'       =   extractConstructors dflags name (visibleIfConDecls ifCons')
+                                         mbField             =   case fieldNames of
+                                                                     [] -> Nothing
+                                   [...incomplete...]



More information about the Pkg-haskell-commits mailing list