From 9bd39a855acea2640828a8771f1d27bbf9d319eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Mon, 16 Jan 2017 20:56:57 +0100 Subject: [PATCH 1/3] CPP around optparse-applicative and hse conflicts --- Language/Haskell/GhcMod/FillSig.hs | 8 ++++++++ Language/Haskell/GhcMod/SrcUtils.hs | 8 ++++++++ ghc-mod.cabal | 8 ++++---- src/GHCMod/Options/Commands.hs | 9 ++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Language/Haskell/GhcMod/FillSig.hs b/Language/Haskell/GhcMod/FillSig.hs index 3e03ec0..7b4f3ba 100644 --- a/Language/Haskell/GhcMod/FillSig.hs +++ b/Language/Haskell/GhcMod/FillSig.hs @@ -27,7 +27,11 @@ import qualified HsBinds as Ty import qualified Class as Ty import qualified Var as Ty import qualified HsPat as Ty +#if MIN_VERSION_haskell_src_exts(1,18,0) import qualified Language.Haskell.Exts as HE +#else +import qualified Language.Haskell.Exts.Annotated as HE +#endif import Djinn.GHC import qualified Language.Haskell.GhcMod.Gap as Gap @@ -191,7 +195,11 @@ getSignatureFromHE file lineNo colNo = do HE.TypeSig (HE.SrcSpanInfo s _) names ty -> return $ HESignature s names ty +#if MIN_VERSION_haskell_src_exts(1,18,0) HE.TypeFamDecl (HE.SrcSpanInfo s _) declHead _ _ -> +#else + HE.TypeFamDecl (HE.SrcSpanInfo s _) declHead _ -> +#endif let (name, tys) = dHeadTyVars declHead in return $ HEFamSignature s Open name (map cleanTyVarBind tys) diff --git a/Language/Haskell/GhcMod/SrcUtils.hs b/Language/Haskell/GhcMod/SrcUtils.hs index 5829fde..912de92 100644 --- a/Language/Haskell/GhcMod/SrcUtils.hs +++ b/Language/Haskell/GhcMod/SrcUtils.hs @@ -16,7 +16,11 @@ import qualified Var as G import qualified Type as G import GHC.SYB.Utils import GhcMonad +#if MIN_VERSION_haskell_src_exts(1,18,0) import qualified Language.Haskell.Exts as HE +#else +import qualified Language.Haskell.Exts.Annotated as HE +#endif import Language.Haskell.GhcMod.Doc import Language.Haskell.GhcMod.Gap import qualified Language.Haskell.GhcMod.Gap as Gap @@ -175,7 +179,11 @@ fourIntsHE loc = ( HE.srcSpanStartLine loc, HE.srcSpanStartColumn loc typeSigInRangeHE :: Int -> Int -> HE.Decl HE.SrcSpanInfo -> Bool typeSigInRangeHE lineNo colNo (HE.TypeSig (HE.SrcSpanInfo s _) _ _) = HE.srcSpanStart s <= (lineNo, colNo) && HE.srcSpanEnd s >= (lineNo, colNo) +#if MIN_VERSION_haskell_src_exts(1,18,0) typeSigInRangeHE lineNo colNo (HE.TypeFamDecl (HE.SrcSpanInfo s _) _ _ _) = +#else +typeSigInRangeHE lineNo colNo (HE.TypeFamDecl (HE.SrcSpanInfo s _) _ _) = +#endif HE.srcSpanStart s <= (lineNo, colNo) && HE.srcSpanEnd s >= (lineNo, colNo) typeSigInRangeHE lineNo colNo (HE.DataFamDecl (HE.SrcSpanInfo s _) _ _ _) = HE.srcSpanStart s <= (lineNo, colNo) && HE.srcSpanEnd s >= (lineNo, colNo) diff --git a/ghc-mod.cabal b/ghc-mod.cabal index 92f2b9b..20af5b7 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -200,14 +200,14 @@ Library , mtl < 2.3 && >= 2.0 , monad-control < 1.1 && >= 1 , split < 0.3 - , haskell-src-exts < 1.19 && >= 1.18 + , haskell-src-exts < 1.19 && >= 1.16.0.1 , text < 1.3 , djinn-ghc < 0.1 && >= 0.0.2.2 , fclabels == 2.0.* , extra == 1.5.* , pipes == 4.3.* , safe < 0.4 && >= 0.3.9 - , optparse-applicative >=0.13.0 && <0.14.0 + , optparse-applicative >=0.11.0 && <0.14.0 , template-haskell , syb if impl(ghc < 7.8) @@ -236,7 +236,7 @@ Executable ghc-mod , ghc < 8.1 , monad-control ==1.0.* , fclabels ==2.0.* - , optparse-applicative >=0.13.0 && <0.14.0 + , optparse-applicative >=0.11.0 && <0.14.0 , semigroups < 0.19 && >= 0.10.0 , ghc-mod @@ -250,7 +250,7 @@ Executable ghc-modi Cpp-Options: -DWINDOWS Default-Extensions: ConstraintKinds, FlexibleContexts HS-Source-Dirs: src, . - Build-Depends: base (< 5 && > 4.7) || (>= 4.0 && < 4.7) + Build-Depends: base < 5 && >= 4.0 , binary < 0.9 && >= 0.5.1.0 , deepseq < 1.5 , directory < 1.4 diff --git a/src/GHCMod/Options/Commands.hs b/src/GHCMod/Options/Commands.hs index 9a486ac..38c6c25 100644 --- a/src/GHCMod/Options/Commands.hs +++ b/src/GHCMod/Options/Commands.hs @@ -13,12 +13,14 @@ -- -- You should have received a copy of the GNU Affero General Public License -- along with this program. If not, see . -{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP, OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-} module GHCMod.Options.Commands where +#if MIN_VERSION_optparse_applicative(0,13,0) import Data.Semigroup +#endif import Options.Applicative import Options.Applicative.Types import Options.Applicative.Builder.Internal @@ -290,8 +292,13 @@ hsubparser' :: Mod CommandFields a -> Parser a hsubparser' m = mkParser d g rdr where Mod _ d g = m `mappend` metavar "" +#if MIN_VERSION_optparse_applicative(0,13,0) (ms,cmds, subs) = mkCommand m rdr = CmdReader ms cmds (fmap add_helper . subs) +#else + (cmds, subs) = mkCommand m + rdr = CmdReader cmds (fmap add_helper . subs) +#endif add_helper pinfo = pinfo { infoParser = infoParser pinfo <**> helper } From 6ee5d04bbf8d562117041db46f55847c15b6ea33 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Mon, 16 Jan 2017 23:17:33 +0200 Subject: [PATCH 2/3] Update bounds --- ghc-mod.cabal | 45 +++++++++++++++++++++++---------------------- stack-8.yaml | 5 +++-- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/ghc-mod.cabal b/ghc-mod.cabal index 20af5b7..e9dcd58 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -180,38 +180,39 @@ Library , bytestring < 0.11 , binary < 0.9 && >= 0.5.1.0 , containers < 0.6 - , cabal-helper < 0.8 && >= 0.7.1.0 + , cabal-helper < 0.8 && >= 0.7.2.0 , deepseq < 1.5 - , directory < 1.4 + , directory < 1.5 , filepath < 1.5 , ghc < 8.2 && >= 7.6 - , ghc-paths < 0.2 - , ghc-syb-utils < 0.3 + , ghc-paths < 0.2 && >= 0.1.0.9 + , ghc-syb-utils < 0.3 && >= 0.2.3 , hlint < 1.10 && >= 1.9.27 , monad-journal < 0.8 && >= 0.4 , old-time < 1.2 , pretty < 1.2 , process < 1.5 - , syb < 0.7 - , temporary < 1.3 + , syb < 0.7 && >= 0.5.1 + , temporary < 1.3 && >= 1.2.0.3 + , transformers < 0.6 , time < 1.7 , transformers < 0.6 - , transformers-base < 0.5 - , mtl < 2.3 && >= 2.0 - , monad-control < 1.1 && >= 1 - , split < 0.3 + , transformers-base < 0.5 && >= 0.4.4 + , mtl < 2.3 && >= 2.0 + , monad-control < 1.1 && >= 1 + , split < 0.3 && >= 0.2.2 , haskell-src-exts < 1.19 && >= 1.16.0.1 - , text < 1.3 - , djinn-ghc < 0.1 && >= 0.0.2.2 + , text < 1.3 && >= 1.2.1.3 + , djinn-ghc < 0.1 && >= 0.0.2.2 , fclabels == 2.0.* - , extra == 1.5.* - , pipes == 4.3.* + , extra < 1.6 && >= 1.4.0 + , pipes < 4.4 && >= 4.1.0 , safe < 0.4 && >= 0.3.9 , optparse-applicative >=0.11.0 && <0.14.0 , template-haskell , syb if impl(ghc < 7.8) - Build-Depends: convertible + Build-Depends: convertible < 1.2 && >= 1.1.0.0 if impl(ghc >= 8.0) Build-Depends: ghc-boot @@ -227,14 +228,14 @@ Executable ghc-mod Default-Extensions: ConstraintKinds, FlexibleContexts HS-Source-Dirs: src Build-Depends: base < 5 && >= 4.0 - , directory < 1.4 + , directory < 1.5 , filepath < 1.5 , pretty < 1.2 , process < 1.5 - , split < 0.3 + , split < 0.3 && >= 0.2.2 , mtl < 2.3 && >= 2.0 - , ghc < 8.1 - , monad-control ==1.0.* + , ghc < 8.2 && >= 7.6 + , monad-control < 1.1 && >= 1 , fclabels ==2.0.* , optparse-applicative >=0.11.0 && <0.14.0 , semigroups < 0.19 && >= 0.10.0 @@ -253,7 +254,7 @@ Executable ghc-modi Build-Depends: base < 5 && >= 4.0 , binary < 0.9 && >= 0.5.1.0 , deepseq < 1.5 - , directory < 1.4 + , directory < 1.5 , filepath < 1.5 , process < 1.5 , old-time < 1.2 @@ -268,7 +269,7 @@ Test-Suite doctest Default-Extensions: ConstraintKinds, FlexibleContexts Main-Is: doctests.hs Build-Depends: base - , doctest >= 0.9.3 + , doctest < 0.12 && >= 0.9.3 Test-Suite spec Default-Language: Haskell2010 @@ -298,7 +299,7 @@ Test-Suite spec FileMappingSpec ShellParseSpec - Build-Depends: hspec >= 2.0.0 + Build-Depends: hspec < 2.4 && >= 2.0.0 X-Build-Depends-Like: CLibName Source-Repository head diff --git a/stack-8.yaml b/stack-8.yaml index 2d4ead8..fbff698 100644 --- a/stack-8.yaml +++ b/stack-8.yaml @@ -1,5 +1,6 @@ +resolver: nightly-2017-01-16 flags: {} packages: - '.' -extra-deps: [] -resolver: nightly-2016-06-04 +extra-deps: +- cabal-helper-0.7.2.0 From 7399619e052485e3ee511cef40976683612a3b26 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Mon, 16 Jan 2017 23:37:35 +0200 Subject: [PATCH 3/3] Use newer cabal-helper. And fix directory upper bound --- ghc-mod.cabal | 8 ++++---- stack-8.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ghc-mod.cabal b/ghc-mod.cabal index e9dcd58..46cf899 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -180,9 +180,9 @@ Library , bytestring < 0.11 , binary < 0.9 && >= 0.5.1.0 , containers < 0.6 - , cabal-helper < 0.8 && >= 0.7.2.0 + , cabal-helper < 0.8 && >= 0.7.3.0 , deepseq < 1.5 - , directory < 1.5 + , directory < 1.4 , filepath < 1.5 , ghc < 8.2 && >= 7.6 , ghc-paths < 0.2 && >= 0.1.0.9 @@ -228,7 +228,7 @@ Executable ghc-mod Default-Extensions: ConstraintKinds, FlexibleContexts HS-Source-Dirs: src Build-Depends: base < 5 && >= 4.0 - , directory < 1.5 + , directory < 1.4 , filepath < 1.5 , pretty < 1.2 , process < 1.5 @@ -254,7 +254,7 @@ Executable ghc-modi Build-Depends: base < 5 && >= 4.0 , binary < 0.9 && >= 0.5.1.0 , deepseq < 1.5 - , directory < 1.5 + , directory < 1.4 , filepath < 1.5 , process < 1.5 , old-time < 1.2 diff --git a/stack-8.yaml b/stack-8.yaml index fbff698..9ec79cd 100644 --- a/stack-8.yaml +++ b/stack-8.yaml @@ -3,4 +3,4 @@ flags: {} packages: - '.' extra-deps: -- cabal-helper-0.7.2.0 +- cabal-helper-0.7.3.0