Upgrade strategyLeftRight + smth else
parent
422f93db20
commit
b575d4a574
|
@ -17,7 +17,7 @@ import qualified Data.Set as Set
|
|||
import qualified Data.Text as Text
|
||||
import qualified Data.Text.Lazy.Builder as Text.Builder
|
||||
import DataTreePrint
|
||||
import GHC (GenLocated(L), Located, moduleName, moduleNameString)
|
||||
import GHC (GenLocated(L), Located, LocatedAn, moduleName, moduleNameString)
|
||||
import qualified GHC.OldList as List
|
||||
import GHC.Parser.Annotation (AnnKeywordId(..))
|
||||
import GHC.Types.Name (getOccString)
|
||||
|
@ -639,15 +639,15 @@ docNodeMoveToKWDP ast kw shouldRestoreIndent bdm =
|
|||
|
||||
class DocWrapable a where
|
||||
docWrapNode :: ( Data.Data.Data ast)
|
||||
=> Located ast
|
||||
=> LocatedAn an ast
|
||||
-> a
|
||||
-> a
|
||||
docWrapNodePrior :: ( Data.Data.Data ast)
|
||||
=> Located ast
|
||||
=> LocatedAn an ast
|
||||
-> a
|
||||
-> a
|
||||
docWrapNodeRest :: ( Data.Data.Data ast)
|
||||
=> Located ast
|
||||
=> LocatedAn an ast
|
||||
-> a
|
||||
-> a
|
||||
|
||||
|
|
|
@ -275,19 +275,23 @@ derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
|||
$ List.intersperse docCommaSep
|
||||
$ ts
|
||||
<&> \case
|
||||
HsIB _ t -> layoutType t
|
||||
_ -> undefined
|
||||
-- HsIB _ t -> layoutType t
|
||||
, whenMoreThan1Type ")"
|
||||
, rhsStrategy
|
||||
]
|
||||
where
|
||||
strategyLeftRight
|
||||
:: GenLocated (SrcAnn ann) (DerivStrategy GhcPs)
|
||||
-> (ToBriDocM BriDocNumbered, ToBriDocM BriDocNumbered)
|
||||
strategyLeftRight = \case
|
||||
(L _ StockStrategy) -> (docLitS " stock", docEmpty)
|
||||
(L _ AnyclassStrategy) -> (docLitS " anyclass", docEmpty)
|
||||
(L _ NewtypeStrategy) -> (docLitS " newtype", docEmpty)
|
||||
(L _ (StockStrategy _)) -> (docLitS " stock", docEmpty)
|
||||
(L _ (AnyclassStrategy _)) -> (docLitS " anyclass", docEmpty)
|
||||
(L _ (NewtypeStrategy _)) -> (docLitS " newtype", docEmpty)
|
||||
lVia@(L _ (ViaStrategy viaTypes)) ->
|
||||
( docEmpty
|
||||
, case viaTypes of
|
||||
HsIB _ext t ->
|
||||
XViaStrategyPs _epann (L _span (HsSig _sig _bndrs t)) ->
|
||||
docSeq [docWrapNode lVia $ docLitS " via", docSeparator, layoutType t]
|
||||
)
|
||||
|
||||
|
@ -295,9 +299,9 @@ docDeriving :: ToBriDocM BriDocNumbered
|
|||
docDeriving = docLitS "deriving"
|
||||
|
||||
createDetailsDoc
|
||||
:: Text -> HsConDeclDetails GhcPs -> (ToBriDocM BriDocNumbered)
|
||||
:: Text -> HsConDeclH98Details GhcPs -> (ToBriDocM BriDocNumbered)
|
||||
createDetailsDoc consNameStr details = case details of
|
||||
PrefixCon args -> do
|
||||
PrefixCon _ args -> do
|
||||
indentPolicy <- mAsk <&> _conf_layout .> _lconfig_indentPolicy .> confUnpack
|
||||
let
|
||||
singleLine = docSeq
|
||||
|
|
Loading…
Reference in New Issue