Drop support for GHC 8.0
parent
23dace16ed
commit
096c438b23
|
@ -29,9 +29,6 @@ jobs:
|
||||||
- os: ubuntu-18.04
|
- os: ubuntu-18.04
|
||||||
ghc: 8.2.2
|
ghc: 8.2.2
|
||||||
cabal: 3.2.0.0
|
cabal: 3.2.0.0
|
||||||
- os: ubuntu-18.04
|
|
||||||
ghc: 8.0.2
|
|
||||||
cabal: 3.2.0.0
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
|
@ -50,9 +50,6 @@ matrix:
|
||||||
|
|
||||||
##### CABAL #####
|
##### CABAL #####
|
||||||
|
|
||||||
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
|
||||||
compiler: ": #cabal 8.0.2"
|
|
||||||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
|
||||||
- env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
- env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||||
compiler: ": #cabal 8.2.2"
|
compiler: ": #cabal 8.2.2"
|
||||||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
||||||
|
@ -92,9 +89,6 @@ matrix:
|
||||||
compiler: ": #stack default"
|
compiler: ": #stack default"
|
||||||
addons: {apt: {packages: [libgmp-dev]}}
|
addons: {apt: {packages: [libgmp-dev]}}
|
||||||
|
|
||||||
- env: BUILD=stack ARGS="--stack-yaml stack-8.0.2.yaml"
|
|
||||||
compiler: ": #stack 8.0.2"
|
|
||||||
addons: {apt: {packages: [libgmp-dev]}}
|
|
||||||
- env: BUILD=stack ARGS="--stack-yaml stack-8.2.2.yaml"
|
- env: BUILD=stack ARGS="--stack-yaml stack-8.2.2.yaml"
|
||||||
compiler: ": #stack 8.2.2"
|
compiler: ": #stack 8.2.2"
|
||||||
addons: {apt: {packages: [libgmp-dev]}}
|
addons: {apt: {packages: [libgmp-dev]}}
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -5,7 +5,7 @@ test:
|
||||||
|
|
||||||
.PHONY: test-all
|
.PHONY: test-all
|
||||||
test-all:
|
test-all:
|
||||||
$(MAKE) test test-8.6.5 test-8.4.3 test-8.2.2 test-8.0.2
|
$(MAKE) test test-8.6.5 test-8.4.3 test-8.2.2
|
||||||
|
|
||||||
.PHONY: test-8.6.5
|
.PHONY: test-8.6.5
|
||||||
test-8.6.5:
|
test-8.6.5:
|
||||||
|
@ -21,8 +21,3 @@ test-8.4.3:
|
||||||
test-8.2.2:
|
test-8.2.2:
|
||||||
echo "test 8.2.2"
|
echo "test 8.2.2"
|
||||||
stack test --stack-yaml stack-8.2.2.yaml --work-dir .stack-work-8.2.2
|
stack test --stack-yaml stack-8.2.2.yaml --work-dir .stack-work-8.2.2
|
||||||
|
|
||||||
.PHONY: test-8.0.2
|
|
||||||
test-8.0.2:
|
|
||||||
echo "test 8.0.2"
|
|
||||||
stack test --stack-yaml stack-8.0.2.yaml --work-dir .stack-work-8.0.2
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ log the size of the input, but _not_ the full input/output of requests.)
|
||||||
|
|
||||||
# Other usage notes
|
# Other usage notes
|
||||||
|
|
||||||
- Supports GHC versions `8.0`, `8.2`, `8.4`, `8.6`, `8.8`.
|
- Supports GHC versions `8.2`, `8.4`, `8.6`, `8.8`.
|
||||||
- included in stackage with lts>=10.0 (or nightlies dating to >=2017-11-15)
|
- included in stackage with lts>=10.0 (or nightlies dating to >=2017-11-15)
|
||||||
- config (file) documentation is lacking.
|
- config (file) documentation is lacking.
|
||||||
- some config values can not be configured via commandline yet.
|
- some config values can not be configured via commandline yet.
|
||||||
|
|
|
@ -91,8 +91,8 @@ library {
|
||||||
-fno-warn-redundant-constraints
|
-fno-warn-redundant-constraints
|
||||||
}
|
}
|
||||||
build-depends:
|
build-depends:
|
||||||
{ base >=4.9 && <4.15
|
{ base >=4.10 && <4.15
|
||||||
, ghc >=8.0.1 && <8.11
|
, ghc >=8.2.1 && <8.11
|
||||||
, ghc-paths >=0.1.0.9 && <0.2
|
, ghc-paths >=0.1.0.9 && <0.2
|
||||||
, ghc-exactprint >=0.5.8 && <0.6.4
|
, ghc-exactprint >=0.5.8 && <0.6.4
|
||||||
, transformers >=0.5.2.0 && <0.6
|
, transformers >=0.5.2.0 && <0.6
|
||||||
|
@ -118,7 +118,7 @@ library {
|
||||||
, semigroups >=0.18.2 && <0.20
|
, semigroups >=0.18.2 && <0.20
|
||||||
, cmdargs >=0.10.14 && <0.11
|
, cmdargs >=0.10.14 && <0.11
|
||||||
, czipwith >=1.0.1.0 && <1.1
|
, czipwith >=1.0.1.0 && <1.1
|
||||||
, ghc-boot-th >=8.0.1 && <8.11
|
, ghc-boot-th >=8.2.1 && <8.11
|
||||||
, filepath >=1.4.1.0 && <1.5
|
, filepath >=1.4.1.0 && <1.5
|
||||||
, random >= 1.1 && <1.2
|
, random >= 1.1 && <1.2
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,15 +229,12 @@ deriving instance Data (CForwardOptions Identity)
|
||||||
deriving instance Data (CPreProcessorConfig Identity)
|
deriving instance Data (CPreProcessorConfig Identity)
|
||||||
deriving instance Data (CConfig Identity)
|
deriving instance Data (CConfig Identity)
|
||||||
|
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
-- these instances break on earlier ghcs
|
|
||||||
deriving instance Data (CDebugConfig Option)
|
deriving instance Data (CDebugConfig Option)
|
||||||
deriving instance Data (CLayoutConfig Option)
|
deriving instance Data (CLayoutConfig Option)
|
||||||
deriving instance Data (CErrorHandlingConfig Option)
|
deriving instance Data (CErrorHandlingConfig Option)
|
||||||
deriving instance Data (CForwardOptions Option)
|
deriving instance Data (CForwardOptions Option)
|
||||||
deriving instance Data (CPreProcessorConfig Option)
|
deriving instance Data (CPreProcessorConfig Option)
|
||||||
deriving instance Data (CConfig Option)
|
deriving instance Data (CConfig Option)
|
||||||
#endif
|
|
||||||
|
|
||||||
instance Semigroup.Semigroup (CDebugConfig Option) where
|
instance Semigroup.Semigroup (CDebugConfig Option) where
|
||||||
(<>) = gmappend
|
(<>) = gmappend
|
||||||
|
@ -356,4 +353,3 @@ deriveCZipWith ''CErrorHandlingConfig
|
||||||
deriveCZipWith ''CForwardOptions
|
deriveCZipWith ''CForwardOptions
|
||||||
deriveCZipWith ''CPreProcessorConfig
|
deriveCZipWith ''CPreProcessorConfig
|
||||||
deriveCZipWith ''CConfig
|
deriveCZipWith ''CConfig
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ withTransformedAnns ast m = MultiRWSS.mGetRawR >>= \case
|
||||||
#if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */
|
#if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */
|
||||||
warnExtractorCompat :: GHC.Warn -> String
|
warnExtractorCompat :: GHC.Warn -> String
|
||||||
warnExtractorCompat (GHC.Warn _ (L _ s)) = s
|
warnExtractorCompat (GHC.Warn _ (L _ s)) = s
|
||||||
#else /* ghc-8.0 && ghc-8.2 */
|
#else /* ghc-8.2 */
|
||||||
warnExtractorCompat :: GenLocated l String -> String
|
warnExtractorCompat :: GenLocated l String -> String
|
||||||
warnExtractorCompat (L _ s) = s
|
warnExtractorCompat (L _ s) = s
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -297,7 +297,6 @@ createDerivingPar
|
||||||
:: HsDeriving GhcPs -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
|
:: HsDeriving GhcPs -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
|
||||||
createDerivingPar derivs mainDoc = do
|
createDerivingPar derivs mainDoc = do
|
||||||
case derivs of
|
case derivs of
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
(L _ []) -> mainDoc
|
(L _ []) -> mainDoc
|
||||||
(L _ types) ->
|
(L _ types) ->
|
||||||
docPar mainDoc
|
docPar mainDoc
|
||||||
|
@ -306,26 +305,13 @@ createDerivingPar derivs mainDoc = do
|
||||||
$ docWrapNode derivs
|
$ docWrapNode derivs
|
||||||
$ derivingClauseDoc
|
$ derivingClauseDoc
|
||||||
<$> types
|
<$> types
|
||||||
#else
|
|
||||||
Nothing -> mainDoc
|
|
||||||
Just types ->
|
|
||||||
docPar mainDoc
|
|
||||||
$ docEnsureIndent BrIndentRegular
|
|
||||||
$ derivingClauseDoc types
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
derivingClauseDoc :: LHsDerivingClause GhcPs -> ToBriDocM BriDocNumbered
|
derivingClauseDoc :: LHsDerivingClause GhcPs -> ToBriDocM BriDocNumbered
|
||||||
#else
|
|
||||||
derivingClauseDoc :: Located [LHsSigType GhcPs] -> ToBriDocM BriDocNumbered
|
|
||||||
#endif
|
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
derivingClauseDoc (L _ (XHsDerivingClause ext)) = absurdExt ext
|
derivingClauseDoc (L _ (XHsDerivingClause ext)) = absurdExt ext
|
||||||
derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
derivingClauseDoc (L _ (HsDerivingClause mStrategy types)) = case types of
|
|
||||||
#else
|
#else
|
||||||
derivingClauseDoc types = case types of
|
derivingClauseDoc (L _ (HsDerivingClause mStrategy types)) = case types of
|
||||||
#endif
|
#endif
|
||||||
(L _ []) -> docSeq []
|
(L _ []) -> docSeq []
|
||||||
(L _ ts) ->
|
(L _ ts) ->
|
||||||
|
@ -333,11 +319,7 @@ derivingClauseDoc types = case types of
|
||||||
tsLength = length ts
|
tsLength = length ts
|
||||||
whenMoreThan1Type val =
|
whenMoreThan1Type val =
|
||||||
if tsLength > 1 then docLitS val else docLitS ""
|
if tsLength > 1 then docLitS val else docLitS ""
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
(lhsStrategy, rhsStrategy) = maybe (docEmpty, docEmpty) strategyLeftRight mStrategy
|
(lhsStrategy, rhsStrategy) = maybe (docEmpty, docEmpty) strategyLeftRight mStrategy
|
||||||
#else
|
|
||||||
(lhsStrategy, rhsStrategy) = (docEmpty, docEmpty)
|
|
||||||
#endif
|
|
||||||
in
|
in
|
||||||
docSeq
|
docSeq
|
||||||
[ docDeriving
|
[ docDeriving
|
||||||
|
@ -351,15 +333,12 @@ derivingClauseDoc types = case types of
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
HsIB _ t -> layoutType t
|
HsIB _ t -> layoutType t
|
||||||
XHsImplicitBndrs x -> absurdExt x
|
XHsImplicitBndrs x -> absurdExt x
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
HsIB _ t _ -> layoutType t
|
|
||||||
#else
|
#else
|
||||||
HsIB _ t -> layoutType t
|
HsIB _ t _ -> layoutType t
|
||||||
#endif
|
#endif
|
||||||
, whenMoreThan1Type ")"
|
, whenMoreThan1Type ")"
|
||||||
, rhsStrategy
|
, rhsStrategy
|
||||||
]
|
]
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.6 */
|
|
||||||
where
|
where
|
||||||
strategyLeftRight = \case
|
strategyLeftRight = \case
|
||||||
(L _ StockStrategy ) -> (docLitS " stock", docEmpty)
|
(L _ StockStrategy ) -> (docLitS " stock", docEmpty)
|
||||||
|
@ -377,7 +356,6 @@ derivingClauseDoc types = case types of
|
||||||
XHsImplicitBndrs ext -> absurdExt ext
|
XHsImplicitBndrs ext -> absurdExt ext
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
docDeriving :: ToBriDocM BriDocNumbered
|
docDeriving :: ToBriDocM BriDocNumbered
|
||||||
docDeriving = docLitS "deriving"
|
docDeriving = docLitS "deriving"
|
||||||
|
|
|
@ -49,9 +49,7 @@ import BasicTypes ( InlinePragma(..)
|
||||||
, Activation(..)
|
, Activation(..)
|
||||||
, InlineSpec(..)
|
, InlineSpec(..)
|
||||||
, RuleMatchInfo(..)
|
, RuleMatchInfo(..)
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
, LexicalFixity(..)
|
, LexicalFixity(..)
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
import Language.Haskell.GHC.ExactPrint.Types ( mkAnnKey )
|
import Language.Haskell.GHC.ExactPrint.Types ( mkAnnKey )
|
||||||
|
|
||||||
|
@ -100,10 +98,8 @@ layoutSig :: ToBriDoc Sig
|
||||||
layoutSig lsig@(L _loc sig) = case sig of
|
layoutSig lsig@(L _loc sig) = case sig of
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
TypeSig _ names (HsWC _ (HsIB _ typ)) -> layoutNamesAndType Nothing names typ
|
TypeSig _ names (HsWC _ (HsIB _ typ)) -> layoutNamesAndType Nothing names typ
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
|
#else /* ghc-8.2 */
|
||||||
TypeSig names (HsWC _ (HsIB _ typ _)) -> layoutNamesAndType Nothing names typ
|
TypeSig names (HsWC _ (HsIB _ typ _)) -> layoutNamesAndType Nothing names typ
|
||||||
#else /* ghc-8.0 */
|
|
||||||
TypeSig names (HsIB _ (HsWC _ _ typ)) -> layoutNamesAndType Nothing names typ
|
|
||||||
#endif
|
#endif
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
InlineSig _ name (InlinePragma _ spec _arity phaseAct conlike) ->
|
InlineSig _ name (InlinePragma _ spec _arity phaseAct conlike) ->
|
||||||
|
@ -128,17 +124,13 @@ layoutSig lsig@(L _loc sig) = case sig of
|
||||||
<> Text.pack " #-}"
|
<> Text.pack " #-}"
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
ClassOpSig _ False names (HsIB _ typ) -> layoutNamesAndType Nothing names typ
|
ClassOpSig _ False names (HsIB _ typ) -> layoutNamesAndType Nothing names typ
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
|
#else /* ghc-8.2 */
|
||||||
ClassOpSig False names (HsIB _ typ _) -> layoutNamesAndType Nothing names typ
|
ClassOpSig False names (HsIB _ typ _) -> layoutNamesAndType Nothing names typ
|
||||||
#else /* ghc-8.0 */
|
|
||||||
ClassOpSig False names (HsIB _ typ) -> layoutNamesAndType Nothing names typ
|
|
||||||
#endif
|
#endif
|
||||||
#if MIN_VERSION_ghc(8,6,0)
|
#if MIN_VERSION_ghc(8,6,0)
|
||||||
PatSynSig _ names (HsIB _ typ) -> layoutNamesAndType (Just "pattern") names typ
|
PatSynSig _ names (HsIB _ typ) -> layoutNamesAndType (Just "pattern") names typ
|
||||||
#elif MIN_VERSION_ghc(8,2,0)
|
|
||||||
PatSynSig names (HsIB _ typ _) -> layoutNamesAndType (Just "pattern") names typ
|
|
||||||
#else
|
#else
|
||||||
PatSynSig name (HsIB _ typ) -> layoutNamesAndType (Just "pattern") [name] typ
|
PatSynSig names (HsIB _ typ _) -> layoutNamesAndType (Just "pattern") names typ
|
||||||
#endif
|
#endif
|
||||||
_ -> briDocByExactNoComment lsig -- TODO
|
_ -> briDocByExactNoComment lsig -- TODO
|
||||||
where
|
where
|
||||||
|
@ -359,10 +351,8 @@ layoutPatternBind funId binderDoc lmatch@(L _ match) = do
|
||||||
Match _ (FunRhs matchId _ _) _ _ -> Just <$> lrdrNameToTextAnn matchId
|
Match _ (FunRhs matchId _ _) _ _ -> Just <$> lrdrNameToTextAnn matchId
|
||||||
#elif MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */
|
#elif MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */
|
||||||
Match (FunRhs matchId _ _) _ _ -> Just <$> lrdrNameToTextAnn matchId
|
Match (FunRhs matchId _ _) _ _ -> Just <$> lrdrNameToTextAnn matchId
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.4 */
|
|
||||||
Match (FunRhs matchId _ _) _ _ _ -> Just <$> lrdrNameToTextAnn matchId
|
|
||||||
#else
|
#else
|
||||||
Match (FunBindMatch matchId _) _ _ _ -> Just <$> lrdrNameToTextAnn matchId
|
Match (FunRhs matchId _ _) _ _ _ -> Just <$> lrdrNameToTextAnn matchId
|
||||||
#endif
|
#endif
|
||||||
_ -> pure Nothing
|
_ -> pure Nothing
|
||||||
let mIdStr' = fixPatternBindIdentifier match <$> mIdStr
|
let mIdStr' = fixPatternBindIdentifier match <$> mIdStr
|
||||||
|
@ -406,7 +396,6 @@ layoutPatternBind funId binderDoc lmatch@(L _ match) = do
|
||||||
mWhereArg
|
mWhereArg
|
||||||
hasComments
|
hasComments
|
||||||
|
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 && ghc-8.4 */
|
|
||||||
fixPatternBindIdentifier
|
fixPatternBindIdentifier
|
||||||
:: Match GhcPs (LHsExpr GhcPs) -> Text -> Text
|
:: Match GhcPs (LHsExpr GhcPs) -> Text -> Text
|
||||||
fixPatternBindIdentifier match idStr = go $ m_ctxt match
|
fixPatternBindIdentifier match idStr = go $ m_ctxt match
|
||||||
|
@ -424,10 +413,6 @@ fixPatternBindIdentifier match idStr = go $ m_ctxt match
|
||||||
(ParStmtCtxt ctx1) -> goInner ctx1
|
(ParStmtCtxt ctx1) -> goInner ctx1
|
||||||
(TransStmtCtxt ctx1) -> goInner ctx1
|
(TransStmtCtxt ctx1) -> goInner ctx1
|
||||||
_ -> idStr
|
_ -> idStr
|
||||||
#else /* ghc-8.0 */
|
|
||||||
fixPatternBindIdentifier :: Match GhcPs (LHsExpr GhcPs) -> Text -> Text
|
|
||||||
fixPatternBindIdentifier _ x = x
|
|
||||||
#endif
|
|
||||||
|
|
||||||
layoutPatternBindFinal
|
layoutPatternBindFinal
|
||||||
:: Maybe Text
|
:: Maybe Text
|
||||||
|
@ -842,18 +827,11 @@ layoutTyCl ltycl@(L _loc tycl) = case tycl of
|
||||||
let isInfix = case fixity of
|
let isInfix = case fixity of
|
||||||
Prefix -> False
|
Prefix -> False
|
||||||
Infix -> True
|
Infix -> True
|
||||||
#elif MIN_VERSION_ghc(8,2,0)
|
#else
|
||||||
SynDecl name vars fixity typ _ -> do
|
SynDecl name vars fixity typ _ -> do
|
||||||
let isInfix = case fixity of
|
let isInfix = case fixity of
|
||||||
Prefix -> False
|
Prefix -> False
|
||||||
Infix -> True
|
Infix -> True
|
||||||
#else
|
|
||||||
SynDecl name vars typ _ -> do
|
|
||||||
nameStr <- lrdrNameToTextAnn name
|
|
||||||
let isInfixTypeOp = case Text.uncons nameStr of
|
|
||||||
Nothing -> False
|
|
||||||
Just (c, _) -> not (c == '(' || isUpper c)
|
|
||||||
isInfix <- (isInfixTypeOp ||) <$> hasAnnKeyword name AnnBackquote
|
|
||||||
#endif
|
#endif
|
||||||
-- hasTrailingParen <- hasAnnKeywordComment ltycl AnnCloseP
|
-- hasTrailingParen <- hasAnnKeywordComment ltycl AnnCloseP
|
||||||
-- let parenWrapper = if hasTrailingParen
|
-- let parenWrapper = if hasTrailingParen
|
||||||
|
@ -864,10 +842,8 @@ layoutTyCl ltycl@(L _loc tycl) = case tycl of
|
||||||
$ layoutSynDecl isInfix wrapNodeRest name (hsq_explicit vars) typ
|
$ layoutSynDecl isInfix wrapNodeRest name (hsq_explicit vars) typ
|
||||||
#if MIN_VERSION_ghc(8,6,0)
|
#if MIN_VERSION_ghc(8,6,0)
|
||||||
DataDecl _ext name tyVars _ dataDefn ->
|
DataDecl _ext name tyVars _ dataDefn ->
|
||||||
#elif MIN_VERSION_ghc(8,2,0)
|
|
||||||
DataDecl name tyVars _ dataDefn _ _ ->
|
|
||||||
#else
|
#else
|
||||||
DataDecl name tyVars dataDefn _ _ ->
|
DataDecl name tyVars _ dataDefn _ _ ->
|
||||||
#endif
|
#endif
|
||||||
layoutDataDecl ltycl name tyVars dataDefn
|
layoutDataDecl ltycl name tyVars dataDefn
|
||||||
_ -> briDocByExactNoComment ltycl
|
_ -> briDocByExactNoComment ltycl
|
||||||
|
@ -919,14 +895,14 @@ layoutTyVarBndr needsSep lbndr@(L _ bndr) = do
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* 8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* 8.6 */
|
||||||
XTyVarBndr{} -> error "brittany internal error: XTyVarBndr"
|
XTyVarBndr{} -> error "brittany internal error: XTyVarBndr"
|
||||||
UserTyVar _ name -> do
|
UserTyVar _ name -> do
|
||||||
#else /* 8.0 8.2 8.4 */
|
#else /* 8.2 8.4 */
|
||||||
UserTyVar name -> do
|
UserTyVar name -> do
|
||||||
#endif
|
#endif
|
||||||
nameStr <- lrdrNameToTextAnn name
|
nameStr <- lrdrNameToTextAnn name
|
||||||
docSeq $ [docSeparator | needsSep] ++ [docLit nameStr]
|
docSeq $ [docSeparator | needsSep] ++ [docLit nameStr]
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* 8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* 8.6 */
|
||||||
KindedTyVar _ name kind -> do
|
KindedTyVar _ name kind -> do
|
||||||
#else /* 8.0 8.2 8.4 */
|
#else /* 8.2 8.4 */
|
||||||
KindedTyVar name kind -> do
|
KindedTyVar name kind -> do
|
||||||
#endif
|
#endif
|
||||||
nameStr <- lrdrNameToTextAnn name
|
nameStr <- lrdrNameToTextAnn name
|
||||||
|
@ -967,12 +943,8 @@ layoutTyFamInstDecl inClass outerNode tfid = do
|
||||||
FamEqn name pats _fixity typ = hsib_body $ tfid_eqn tfid
|
FamEqn name pats _fixity typ = hsib_body $ tfid_eqn tfid
|
||||||
bndrsMay = Nothing
|
bndrsMay = Nothing
|
||||||
innerNode = outerNode
|
innerNode = outerNode
|
||||||
#elif MIN_VERSION_ghc(8,2,0)
|
|
||||||
innerNode@(L _ (TyFamEqn name boundPats _fixity typ)) = tfid_eqn tfid
|
|
||||||
bndrsMay = Nothing
|
|
||||||
pats = hsib_body boundPats
|
|
||||||
#else
|
#else
|
||||||
innerNode@(L _ (TyFamEqn name boundPats typ)) = tfid_eqn tfid
|
innerNode@(L _ (TyFamEqn name boundPats _fixity typ)) = tfid_eqn tfid
|
||||||
bndrsMay = Nothing
|
bndrsMay = Nothing
|
||||||
pats = hsib_body boundPats
|
pats = hsib_body boundPats
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,10 +62,8 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
briDocByExactInlineOnly "HsRecFld" lexpr
|
briDocByExactInlineOnly "HsRecFld" lexpr
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
HsOverLabel _ext _reboundFromLabel name ->
|
HsOverLabel _ext _reboundFromLabel name ->
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
|
#else /* ghc-8.2 */
|
||||||
HsOverLabel _reboundFromLabel name ->
|
HsOverLabel _reboundFromLabel name ->
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsOverLabel name ->
|
|
||||||
#endif
|
#endif
|
||||||
let label = FastString.unpackFS name
|
let label = FastString.unpackFS name
|
||||||
in docLit . Text.pack $ '#' : label
|
in docLit . Text.pack $ '#' : label
|
||||||
|
@ -176,19 +174,15 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
#endif
|
#endif
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
HsLamCase _ (MG _ (L _ []) _) -> do
|
HsLamCase _ (MG _ (L _ []) _) -> do
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4*/
|
#else /* ghc-8.2 */
|
||||||
HsLamCase (MG (L _ []) _ _ _) -> do
|
HsLamCase (MG (L _ []) _ _ _) -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsLamCase _ (MG (L _ []) _ _ _) -> do
|
|
||||||
#endif
|
#endif
|
||||||
docSetParSpacing $ docAddBaseY BrIndentRegular $
|
docSetParSpacing $ docAddBaseY BrIndentRegular $
|
||||||
(docLit $ Text.pack "\\case {}")
|
(docLit $ Text.pack "\\case {}")
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
HsLamCase _ (MG _ lmatches@(L _ matches) _) -> do
|
HsLamCase _ (MG _ lmatches@(L _ matches) _) -> do
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4*/
|
#else /* ghc-8.2 */
|
||||||
HsLamCase (MG lmatches@(L _ matches) _ _ _) -> do
|
HsLamCase (MG lmatches@(L _ matches) _ _ _) -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsLamCase _ (MG lmatches@(L _ matches) _ _ _) -> do
|
|
||||||
#endif
|
#endif
|
||||||
binderDoc <- docLit $ Text.pack "->"
|
binderDoc <- docLit $ Text.pack "->"
|
||||||
funcPatDocs <- docWrapNode lmatches
|
funcPatDocs <- docWrapNode lmatches
|
||||||
|
@ -311,10 +305,8 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
HsAppType XHsWildCardBndrs{} _ ->
|
HsAppType XHsWildCardBndrs{} _ ->
|
||||||
error "brittany internal error: HsAppType XHsWildCardBndrs"
|
error "brittany internal error: HsAppType XHsWildCardBndrs"
|
||||||
HsAppType (HsWC _ ty1) exp1 -> do
|
HsAppType (HsWC _ ty1) exp1 -> do
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
|
#else /* ghc-8.2 */
|
||||||
HsAppType exp1 (HsWC _ ty1) -> do
|
HsAppType exp1 (HsWC _ ty1) -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsAppType exp1 (HsWC _ _ ty1) -> do
|
|
||||||
#endif
|
#endif
|
||||||
t <- docSharedWrapper layoutType ty1
|
t <- docSharedWrapper layoutType ty1
|
||||||
e <- docSharedWrapper layoutExpr exp1
|
e <- docSharedWrapper layoutExpr exp1
|
||||||
|
@ -329,7 +321,7 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
e
|
e
|
||||||
(docSeq [docLit $ Text.pack "@", t ])
|
(docSeq [docLit $ Text.pack "@", t ])
|
||||||
]
|
]
|
||||||
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.0 8.2 8.4 */
|
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.2 8.4 */
|
||||||
HsAppTypeOut{} -> do
|
HsAppTypeOut{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "HsAppTypeOut{}" lexpr
|
briDocByExactInlineOnly "HsAppTypeOut{}" lexpr
|
||||||
|
@ -968,7 +960,7 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
|
in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
|
||||||
ExplicitList _ _ [] ->
|
ExplicitList _ _ [] ->
|
||||||
docLit $ Text.pack "[]"
|
docLit $ Text.pack "[]"
|
||||||
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.0 8.2 8.4 */
|
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.2 8.4 */
|
||||||
ExplicitPArr{} -> do
|
ExplicitPArr{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "ExplicitPArr{}" lexpr
|
briDocByExactInlineOnly "ExplicitPArr{}" lexpr
|
||||||
|
@ -1052,10 +1044,8 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
ExprWithTySig XHsWildCardBndrs{} _ ->
|
ExprWithTySig XHsWildCardBndrs{} _ ->
|
||||||
error "brittany internal error: ExprWithTySig XHsWildCardBndrs"
|
error "brittany internal error: ExprWithTySig XHsWildCardBndrs"
|
||||||
ExprWithTySig (HsWC _ (HsIB _ typ1)) exp1 -> do
|
ExprWithTySig (HsWC _ (HsIB _ typ1)) exp1 -> do
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8,4 */
|
#else /* ghc-8.2 */
|
||||||
ExprWithTySig exp1 (HsWC _ (HsIB _ typ1 _)) -> do
|
ExprWithTySig exp1 (HsWC _ (HsIB _ typ1 _)) -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
ExprWithTySig exp1 (HsIB _ (HsWC _ _ typ1)) -> do
|
|
||||||
#endif
|
#endif
|
||||||
expDoc <- docSharedWrapper layoutExpr exp1
|
expDoc <- docSharedWrapper layoutExpr exp1
|
||||||
typDoc <- docSharedWrapper layoutType typ1
|
typDoc <- docSharedWrapper layoutType typ1
|
||||||
|
@ -1064,7 +1054,7 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
, appSep $ docLit $ Text.pack "::"
|
, appSep $ docLit $ Text.pack "::"
|
||||||
, typDoc
|
, typDoc
|
||||||
]
|
]
|
||||||
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.0 8.2 8.4 */
|
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.2 8.4 */
|
||||||
ExprWithTySigOut{} -> do
|
ExprWithTySigOut{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "ExprWithTySigOut{}" lexpr
|
briDocByExactInlineOnly "ExprWithTySigOut{}" lexpr
|
||||||
|
@ -1113,7 +1103,7 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
]
|
]
|
||||||
ArithSeq{} ->
|
ArithSeq{} ->
|
||||||
briDocByExactInlineOnly "ArithSeq" lexpr
|
briDocByExactInlineOnly "ArithSeq" lexpr
|
||||||
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.0 8.2 8.4 */
|
#if !MIN_VERSION_ghc(8,6,0) /* ghc-8.2 8.4 */
|
||||||
PArrSeq{} -> do
|
PArrSeq{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "PArrSeq{}" lexpr
|
briDocByExactInlineOnly "PArrSeq{}" lexpr
|
||||||
|
@ -1195,14 +1185,12 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
HsWrap{} -> do
|
HsWrap{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "HsWrap{}" lexpr
|
briDocByExactInlineOnly "HsWrap{}" lexpr
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
HsConLikeOut{} -> do
|
HsConLikeOut{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "HsWrap{}" lexpr
|
briDocByExactInlineOnly "HsWrap{}" lexpr
|
||||||
ExplicitSum{} -> do
|
ExplicitSum{} -> do
|
||||||
-- TODO
|
-- TODO
|
||||||
briDocByExactInlineOnly "ExplicitSum{}" lexpr
|
briDocByExactInlineOnly "ExplicitSum{}" lexpr
|
||||||
#endif
|
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
XExpr{} -> error "brittany internal error: XExpr"
|
XExpr{} -> error "brittany internal error: XExpr"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1367,7 +1355,7 @@ overLitValBriDoc = \case
|
||||||
HsFractional (FL (SourceText t) _ _) -> BDFLit $ Text.pack t
|
HsFractional (FL (SourceText t) _ _) -> BDFLit $ Text.pack t
|
||||||
HsIsString (SourceText t) _ -> BDFLit $ Text.pack t
|
HsIsString (SourceText t) _ -> BDFLit $ Text.pack t
|
||||||
_ -> error "overLitValBriDoc: literal with no SourceText"
|
_ -> error "overLitValBriDoc: literal with no SourceText"
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
#else /* ghc-8.2 */
|
||||||
litBriDoc :: HsLit -> BriDocFInt
|
litBriDoc :: HsLit -> BriDocFInt
|
||||||
litBriDoc = \case
|
litBriDoc = \case
|
||||||
HsChar (SourceText t) _c -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ ['\'', c, '\'']
|
HsChar (SourceText t) _c -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ ['\'', c, '\'']
|
||||||
|
@ -1391,26 +1379,4 @@ overLitValBriDoc = \case
|
||||||
HsFractional (FL t _) -> BDFLit $ Text.pack t
|
HsFractional (FL t _) -> BDFLit $ Text.pack t
|
||||||
HsIsString (SourceText t) _ -> BDFLit $ Text.pack t
|
HsIsString (SourceText t) _ -> BDFLit $ Text.pack t
|
||||||
_ -> error "overLitValBriDoc: literal with no SourceText"
|
_ -> error "overLitValBriDoc: literal with no SourceText"
|
||||||
#else /* ghc-8.0 */
|
|
||||||
litBriDoc :: HsLit -> BriDocFInt
|
|
||||||
litBriDoc = \case
|
|
||||||
HsChar t _c -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ ['\'', c, '\'']
|
|
||||||
HsCharPrim t _c -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ ['\'', c, '\'']
|
|
||||||
HsString t _fastString -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ FastString.unpackFS fastString
|
|
||||||
HsStringPrim t _byteString -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ Data.ByteString.Char8.unpack byteString
|
|
||||||
HsInt t _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
|
|
||||||
HsIntPrim t _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
|
|
||||||
HsWordPrim t _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
|
|
||||||
HsInt64Prim t _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
|
|
||||||
HsWord64Prim t _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
|
|
||||||
HsInteger t _i _type -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
|
|
||||||
HsRat (FL t _) _type -> BDFLit $ Text.pack t
|
|
||||||
HsFloatPrim (FL t _) -> BDFLit $ Text.pack t
|
|
||||||
HsDoublePrim (FL t _) -> BDFLit $ Text.pack t
|
|
||||||
|
|
||||||
overLitValBriDoc :: OverLitVal -> BriDocFInt
|
|
||||||
overLitValBriDoc = \case
|
|
||||||
HsIntegral t _ -> BDFLit $ Text.pack t
|
|
||||||
HsFractional (FL t _) -> BDFLit $ Text.pack t
|
|
||||||
HsIsString t _ -> BDFLit $ Text.pack t
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ layoutExpr :: ToBriDoc HsExpr
|
||||||
|
|
||||||
#if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */
|
#if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */
|
||||||
litBriDoc :: HsLit GhcPs -> BriDocFInt
|
litBriDoc :: HsLit GhcPs -> BriDocFInt
|
||||||
#else /* ghc-8.0 && ghc-8.2 */
|
#else /* ghc-8.2 */
|
||||||
litBriDoc :: HsLit -> BriDocFInt
|
litBriDoc :: HsLit -> BriDocFInt
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,8 @@ import Language.Haskell.Brittany.Internal.Utils
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
prepareName :: LIEWrappedName name -> Located name
|
prepareName :: LIEWrappedName name -> Located name
|
||||||
prepareName = ieLWrappedName
|
prepareName = ieLWrappedName
|
||||||
#else
|
|
||||||
prepareName :: Located name -> Located name
|
|
||||||
prepareName = id
|
|
||||||
#endif
|
|
||||||
|
|
||||||
layoutIE :: ToBriDoc IE
|
layoutIE :: ToBriDoc IE
|
||||||
layoutIE lie@(L _ ie) = docWrapNode lie $ case ie of
|
layoutIE lie@(L _ ie) = docWrapNode lie $ case ie of
|
||||||
|
@ -111,7 +106,6 @@ layoutIE lie@(L _ ie) = docWrapNode lie $ case ie of
|
||||||
]
|
]
|
||||||
_ -> docEmpty
|
_ -> docEmpty
|
||||||
where
|
where
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2, 8.4, .. */
|
|
||||||
layoutWrapped _ = \case
|
layoutWrapped _ = \case
|
||||||
L _ (IEName n) -> docLit =<< lrdrNameToTextAnn n
|
L _ (IEName n) -> docLit =<< lrdrNameToTextAnn n
|
||||||
L _ (IEPattern n) -> do
|
L _ (IEPattern n) -> do
|
||||||
|
@ -120,16 +114,6 @@ layoutIE lie@(L _ ie) = docWrapNode lie $ case ie of
|
||||||
L _ (IEType n) -> do
|
L _ (IEType n) -> do
|
||||||
name <- lrdrNameToTextAnn n
|
name <- lrdrNameToTextAnn n
|
||||||
docLit $ Text.pack "type " <> name
|
docLit $ Text.pack "type " <> name
|
||||||
#else /* ghc-8.0 */
|
|
||||||
layoutWrapped outer n = do
|
|
||||||
name <- lrdrNameToTextAnn n
|
|
||||||
hasType <- hasAnnKeyword n AnnType
|
|
||||||
hasPattern <- hasAnnKeyword outer AnnPattern
|
|
||||||
docLit $ if
|
|
||||||
| hasType -> Text.pack "type (" <> name <> Text.pack ")"
|
|
||||||
| hasPattern -> Text.pack "pattern " <> name
|
|
||||||
| otherwise -> name
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-- Helper function to deal with Located lists of LIEs.
|
-- Helper function to deal with Located lists of LIEs.
|
||||||
-- In particular this will also associate documentation
|
-- In particular this will also associate documentation
|
||||||
|
|
|
@ -26,24 +26,14 @@ import Language.Haskell.Brittany.Internal.Utils
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
prepPkg :: SourceText -> String
|
prepPkg :: SourceText -> String
|
||||||
prepPkg rawN = case rawN of
|
prepPkg rawN = case rawN of
|
||||||
SourceText n -> n
|
SourceText n -> n
|
||||||
-- This would be odd to encounter and the
|
-- This would be odd to encounter and the
|
||||||
-- result will most certainly be wrong
|
-- result will most certainly be wrong
|
||||||
NoSourceText -> ""
|
NoSourceText -> ""
|
||||||
#else
|
|
||||||
prepPkg :: String -> String
|
|
||||||
prepPkg = id
|
|
||||||
#endif
|
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
prepModName :: Located e -> e
|
prepModName :: Located e -> e
|
||||||
prepModName = unLoc
|
prepModName = unLoc
|
||||||
#else
|
|
||||||
prepModName :: e -> e
|
|
||||||
prepModName = id
|
|
||||||
#endif
|
|
||||||
|
|
||||||
layoutImport :: ToBriDoc ImportDecl
|
layoutImport :: ToBriDoc ImportDecl
|
||||||
layoutImport limportD@(L _ importD) = docWrapNode limportD $ case importD of
|
layoutImport limportD@(L _ importD) = docWrapNode limportD $ case importD of
|
||||||
|
|
|
@ -50,14 +50,14 @@ layoutPat (ghcDL -> lpat@(L _ pat)) = docWrapNode lpat $ case pat of
|
||||||
-- _ -> expr
|
-- _ -> expr
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
VarPat _ n ->
|
VarPat _ n ->
|
||||||
#else /* ghc-8.0 8.2 8.4 */
|
#else /* ghc-8.2 8.4 */
|
||||||
VarPat n ->
|
VarPat n ->
|
||||||
#endif
|
#endif
|
||||||
fmap Seq.singleton $ docLit $ lrdrNameToText n
|
fmap Seq.singleton $ docLit $ lrdrNameToText n
|
||||||
-- abc -> expr
|
-- abc -> expr
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
LitPat _ lit ->
|
LitPat _ lit ->
|
||||||
#else /* ghc-8.0 8.2 8.4 */
|
#else /* ghc-8.2 8.4 */
|
||||||
LitPat lit ->
|
LitPat lit ->
|
||||||
#endif
|
#endif
|
||||||
fmap Seq.singleton $ allocateNode $ litBriDoc lit
|
fmap Seq.singleton $ allocateNode $ litBriDoc lit
|
||||||
|
@ -66,7 +66,7 @@ layoutPat (ghcDL -> lpat@(L _ pat)) = docWrapNode lpat $ case pat of
|
||||||
ParPat _ inner -> do
|
ParPat _ inner -> do
|
||||||
#elif MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#elif MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
ParPat _ inner -> do
|
ParPat _ inner -> do
|
||||||
#else /* ghc-8.0 8.2 8.4 */
|
#else /* ghc-8.2 8.4 */
|
||||||
ParPat inner -> do
|
ParPat inner -> do
|
||||||
#endif
|
#endif
|
||||||
-- (nestedpat) -> expr
|
-- (nestedpat) -> expr
|
||||||
|
@ -202,10 +202,8 @@ layoutPat (ghcDL -> lpat@(L _ pat)) = docWrapNode lpat $ case pat of
|
||||||
SigPat _ pat1 (HsWC _ (HsIB _ ty1)) -> do
|
SigPat _ pat1 (HsWC _ (HsIB _ ty1)) -> do
|
||||||
#elif MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#elif MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
SigPat (HsWC _ (HsIB _ ty1)) pat1 -> do
|
SigPat (HsWC _ (HsIB _ ty1)) pat1 -> do
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
|
#else /* ghc-8.2 */
|
||||||
SigPatIn pat1 (HsWC _ (HsIB _ ty1 _)) -> do
|
SigPatIn pat1 (HsWC _ (HsIB _ ty1 _)) -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
SigPatIn pat1 (HsIB _ (HsWC _ _ ty1)) -> do
|
|
||||||
#endif
|
#endif
|
||||||
-- i :: Int -> expr
|
-- i :: Int -> expr
|
||||||
patDocs <- layoutPat pat1
|
patDocs <- layoutPat pat1
|
||||||
|
@ -260,11 +258,6 @@ layoutPat (ghcDL -> lpat@(L _ pat)) = docWrapNode lpat $ case pat of
|
||||||
Just{} -> Seq.fromList [negDoc, litDoc]
|
Just{} -> Seq.fromList [negDoc, litDoc]
|
||||||
Nothing -> Seq.singleton litDoc
|
Nothing -> Seq.singleton litDoc
|
||||||
|
|
||||||
-- if MIN_VERSION_ghc(8,0,0)
|
|
||||||
-- VarPat n -> return $ stringLayouter lpat $ lrdrNameToText n
|
|
||||||
-- else
|
|
||||||
-- VarPat n -> return $ stringLayouter lpat $ rdrNameToText n
|
|
||||||
-- endif
|
|
||||||
_ -> return <$> briDocByExactInlineOnly "some unknown pattern" (ghcDL lpat)
|
_ -> return <$> briDocByExactInlineOnly "some unknown pattern" (ghcDL lpat)
|
||||||
|
|
||||||
colsWrapPat :: Seq BriDocNumbered -> ToBriDocM BriDocNumbered
|
colsWrapPat :: Seq BriDocNumbered -> ToBriDocM BriDocNumbered
|
||||||
|
|
|
@ -42,7 +42,6 @@ import DataTreePrint
|
||||||
layoutType :: ToBriDoc HsType
|
layoutType :: ToBriDoc HsType
|
||||||
layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
-- _ | traceShow (ExactPrint.Types.mkAnnKey ltype) False -> error "impossible"
|
-- _ | traceShow (ExactPrint.Types.mkAnnKey ltype) False -> error "impossible"
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
#if MIN_VERSION_ghc(8,6,0)
|
#if MIN_VERSION_ghc(8,6,0)
|
||||||
HsTyVar _ promoted name -> do
|
HsTyVar _ promoted name -> do
|
||||||
#else /* ghc-8.2 ghc-8.4 */
|
#else /* ghc-8.2 ghc-8.4 */
|
||||||
|
@ -60,11 +59,6 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
, docWrapNode name $ docLit t
|
, docWrapNode name $ docLit t
|
||||||
]
|
]
|
||||||
NotPromoted -> docWrapNode name $ docLit t
|
NotPromoted -> docWrapNode name $ docLit t
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsTyVar name -> do
|
|
||||||
t <- lrdrNameToTextAnnTypeEqualityIsSpecial name
|
|
||||||
docWrapNode name $ docLit t
|
|
||||||
#endif
|
|
||||||
#if MIN_VERSION_ghc(8,10,1)
|
#if MIN_VERSION_ghc(8,10,1)
|
||||||
HsForAllTy _ _ bndrs (L _ (HsQualTy _ (L _ cntxts) typ2)) -> do
|
HsForAllTy _ _ bndrs (L _ (HsQualTy _ (L _ cntxts) typ2)) -> do
|
||||||
#elif MIN_VERSION_ghc(8,6,0)
|
#elif MIN_VERSION_ghc(8,6,0)
|
||||||
|
@ -547,10 +541,8 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
-- }
|
-- }
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
HsIParamTy _ (L _ (HsIPName ipName)) typ1 -> do
|
HsIParamTy _ (L _ (HsIPName ipName)) typ1 -> do
|
||||||
#elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
|
#else /* ghc-8.2 */
|
||||||
HsIParamTy (L _ (HsIPName ipName)) typ1 -> do
|
HsIParamTy (L _ (HsIPName ipName)) typ1 -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsIParamTy (HsIPName ipName) typ1 -> do
|
|
||||||
#endif
|
#endif
|
||||||
typeDoc1 <- docSharedWrapper layoutType typ1
|
typeDoc1 <- docSharedWrapper layoutType typ1
|
||||||
docAlt
|
docAlt
|
||||||
|
@ -699,11 +691,7 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
briDocByExactInlineOnly "HsDocTy{}" ltype
|
briDocByExactInlineOnly "HsDocTy{}" ltype
|
||||||
HsRecTy{} -> -- TODO
|
HsRecTy{} -> -- TODO
|
||||||
briDocByExactInlineOnly "HsRecTy{}" ltype
|
briDocByExactInlineOnly "HsRecTy{}" ltype
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
HsExplicitListTy _ _ typs -> do
|
HsExplicitListTy _ _ typs -> do
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsExplicitListTy _ typs -> do
|
|
||||||
#endif
|
|
||||||
typDocs <- docSharedWrapper layoutType `mapM` typs
|
typDocs <- docSharedWrapper layoutType `mapM` typs
|
||||||
hasComments <- hasAnyCommentsBelow ltype
|
hasComments <- hasAnyCommentsBelow ltype
|
||||||
let specialCommaSep = appSep $ docLit $ Text.pack " ,"
|
let specialCommaSep = appSep $ docLit $ Text.pack " ,"
|
||||||
|
@ -755,27 +743,20 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
#else
|
#else
|
||||||
HsTyLit lit -> case lit of
|
HsTyLit lit -> case lit of
|
||||||
#endif
|
#endif
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
HsNumTy (SourceText srctext) _ -> docLit $ Text.pack srctext
|
HsNumTy (SourceText srctext) _ -> docLit $ Text.pack srctext
|
||||||
HsNumTy NoSourceText _ ->
|
HsNumTy NoSourceText _ ->
|
||||||
error "overLitValBriDoc: literal with no SourceText"
|
error "overLitValBriDoc: literal with no SourceText"
|
||||||
HsStrTy (SourceText srctext) _ -> docLit $ Text.pack srctext
|
HsStrTy (SourceText srctext) _ -> docLit $ Text.pack srctext
|
||||||
HsStrTy NoSourceText _ ->
|
HsStrTy NoSourceText _ ->
|
||||||
error "overLitValBriDoc: literal with no SourceText"
|
error "overLitValBriDoc: literal with no SourceText"
|
||||||
#else /* ghc-8.0 */
|
|
||||||
HsNumTy srctext _ -> docLit $ Text.pack srctext
|
|
||||||
HsStrTy srctext _ -> docLit $ Text.pack srctext
|
|
||||||
#endif
|
|
||||||
#if !MIN_VERSION_ghc(8,6,0)
|
#if !MIN_VERSION_ghc(8,6,0)
|
||||||
HsCoreTy{} -> -- TODO
|
HsCoreTy{} -> -- TODO
|
||||||
briDocByExactInlineOnly "HsCoreTy{}" ltype
|
briDocByExactInlineOnly "HsCoreTy{}" ltype
|
||||||
#endif
|
#endif
|
||||||
HsWildCardTy _ ->
|
HsWildCardTy _ ->
|
||||||
docLit $ Text.pack "_"
|
docLit $ Text.pack "_"
|
||||||
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2 */
|
|
||||||
HsSumTy{} -> -- TODO
|
HsSumTy{} -> -- TODO
|
||||||
briDocByExactInlineOnly "HsSumTy{}" ltype
|
briDocByExactInlineOnly "HsSumTy{}" ltype
|
||||||
#endif
|
|
||||||
#if MIN_VERSION_ghc(8,6,0)
|
#if MIN_VERSION_ghc(8,6,0)
|
||||||
HsStarTy _ isUnicode -> do
|
HsStarTy _ isUnicode -> do
|
||||||
if isUnicode
|
if isUnicode
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if !MIN_VERSION_ghc(8,4,0) /* ghc-8.0, ghc-8.2 */
|
#if !MIN_VERSION_ghc(8,4,0) /* ghc-8.2 */
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ todo :: a
|
||||||
todo = error "todo"
|
todo = error "todo"
|
||||||
|
|
||||||
|
|
||||||
#if !MIN_VERSION_ghc(8,4,0) /* ghc-8.0, ghc-8.2 */
|
#if !MIN_VERSION_ghc(8,4,0) /* ghc-8.2 */
|
||||||
type family IdP p
|
type family IdP p
|
||||||
type instance IdP GhcPs = RdrName
|
type instance IdP GhcPs = RdrName
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ type GhcPs = RdrName
|
||||||
#if MIN_VERSION_ghc(8,8,0)
|
#if MIN_VERSION_ghc(8,8,0)
|
||||||
ghcDL :: GHC.HasSrcSpan a => a -> GHC.Located (GHC.SrcSpanLess a)
|
ghcDL :: GHC.HasSrcSpan a => a -> GHC.Located (GHC.SrcSpanLess a)
|
||||||
ghcDL = GHC.dL
|
ghcDL = GHC.dL
|
||||||
#else /* ghc-8.0 8.2 8.4 8.6 */
|
#else /* ghc-8.2 8.4 8.6 */
|
||||||
ghcDL :: GHC.Located a -> GHC.Located a
|
ghcDL :: GHC.Located a -> GHC.Located a
|
||||||
ghcDL x = x
|
ghcDL x = x
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,9 +32,7 @@ data PerItemConfig = PerItemConfig
|
||||||
{ _icd_perBinding :: Map String (CConfig Option)
|
{ _icd_perBinding :: Map String (CConfig Option)
|
||||||
, _icd_perKey :: Map ExactPrint.Types.AnnKey (CConfig Option)
|
, _icd_perKey :: Map ExactPrint.Types.AnnKey (CConfig Option)
|
||||||
}
|
}
|
||||||
#if MIN_VERSION_ghc(8,2,0)
|
|
||||||
deriving Data.Data.Data
|
deriving Data.Data.Data
|
||||||
#endif
|
|
||||||
|
|
||||||
type PPM = MultiRWSS.MultiRWS
|
type PPM = MultiRWSS.MultiRWS
|
||||||
'[Map ExactPrint.AnnKey ExactPrint.Anns, PerItemConfig, Config, ExactPrint.Anns]
|
'[Map ExactPrint.AnnKey ExactPrint.Anns, PerItemConfig, Config, ExactPrint.Anns]
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
resolver: lts-9.0
|
|
||||||
|
|
||||||
extra-deps:
|
|
||||||
- monad-memo-0.4.1
|
|
||||||
- czipwith-1.0.1.0
|
|
||||||
- butcher-1.3.1.1
|
|
||||||
- data-tree-print-0.1.0.0
|
|
||||||
- deque-0.2
|
|
||||||
- ghc-exactprint-0.5.8.0
|
|
||||||
|
|
||||||
packages:
|
|
||||||
- .
|
|
|
@ -1,54 +0,0 @@
|
||||||
# This file was autogenerated by Stack.
|
|
||||||
# You should not edit this file by hand.
|
|
||||||
# For more information, please see the documentation at:
|
|
||||||
# https://docs.haskellstack.org/en/stable/lock_files
|
|
||||||
|
|
||||||
packages:
|
|
||||||
- completed:
|
|
||||||
hackage: monad-memo-0.4.1@sha256:d7575b0c89ad21818ca5746170d10a3b92f01fdf9028fa37d3a370e42b24b38b,3672
|
|
||||||
pantry-tree:
|
|
||||||
size: 1823
|
|
||||||
sha256: 8d7bcc8a8bce43804613a160fd7f0fea7869a54e530a9f1b9f9e853ec4e00b57
|
|
||||||
original:
|
|
||||||
hackage: monad-memo-0.4.1
|
|
||||||
- completed:
|
|
||||||
hackage: czipwith-1.0.1.0@sha256:30751c5a92488304863f20403cd8e9d4fee2b5def0b656a3d979aa3331a09c00,1652
|
|
||||||
pantry-tree:
|
|
||||||
size: 323
|
|
||||||
sha256: acd60968c5a1945741204751243f88d1af1c152018c2d9575f62c0805825f44f
|
|
||||||
original:
|
|
||||||
hackage: czipwith-1.0.1.0
|
|
||||||
- completed:
|
|
||||||
hackage: butcher-1.3.1.1@sha256:d5734df2e42c28c5a8419eb8251cc531e5f5e6a13794b2ae1dac04abd1c359ad,3242
|
|
||||||
pantry-tree:
|
|
||||||
size: 1197
|
|
||||||
sha256: 057b5c8aa0211951337d87cda1f3d4c6f049945314f6fc7883394eebac79be5b
|
|
||||||
original:
|
|
||||||
hackage: butcher-1.3.1.1
|
|
||||||
- completed:
|
|
||||||
hackage: data-tree-print-0.1.0.0@sha256:6610723626501d3ab65dc2290c0de59de8d042caf72a1db1e0cd01e84d229346,1547
|
|
||||||
pantry-tree:
|
|
||||||
size: 272
|
|
||||||
sha256: caa741fd498f754b42d45a16aae455056d5e71df51e960fce1579b8e8b6496ad
|
|
||||||
original:
|
|
||||||
hackage: data-tree-print-0.1.0.0
|
|
||||||
- completed:
|
|
||||||
hackage: deque-0.2@sha256:a9736298cd04472924b3b681b3791c99e8b6009a6e5df1ff13dd57457109ad43,877
|
|
||||||
pantry-tree:
|
|
||||||
size: 205
|
|
||||||
sha256: c48e1f58dfac107ba9dd8d159d4c033fd72521de678204788e3f01f7a2e17546
|
|
||||||
original:
|
|
||||||
hackage: deque-0.2
|
|
||||||
- completed:
|
|
||||||
hackage: ghc-exactprint-0.5.8.0@sha256:71915a08a7d442d39a63cb3b0fbd90b7dacd19bc4b05bac5c53b6e8a0d931b7b,7728
|
|
||||||
pantry-tree:
|
|
||||||
size: 83871
|
|
||||||
sha256: 3998143d33f7de29b31e8cf8d1b207c1fb4962f819fc820e209e1eecbf7e5a35
|
|
||||||
original:
|
|
||||||
hackage: ghc-exactprint-0.5.8.0
|
|
||||||
snapshots:
|
|
||||||
- completed:
|
|
||||||
size: 533451
|
|
||||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/9/0.yaml
|
|
||||||
sha256: 27f29b231b39ea68e967a7a4346b2693a49d77c50f41fc0c276e11189a538da7
|
|
||||||
original: lts-9.0
|
|
Loading…
Reference in New Issue