Typefix DataDecl (??)
parent
ed5bf856a9
commit
648d4a0459
|
@ -20,7 +20,8 @@ import Language.Haskell.Brittany.Internal.Types
|
||||||
|
|
||||||
|
|
||||||
layoutDataDecl
|
layoutDataDecl
|
||||||
:: LocatedAn an1 (TyClDecl GhcPs)
|
:: Data.Data.Data an1
|
||||||
|
=> LocatedAn an1 (TyClDecl GhcPs)
|
||||||
-> LocatedAn an2 RdrName
|
-> LocatedAn an2 RdrName
|
||||||
-> LHsQTyVars GhcPs
|
-> LHsQTyVars GhcPs
|
||||||
-> HsDataDefn GhcPs
|
-> HsDataDefn GhcPs
|
||||||
|
@ -247,20 +248,20 @@ createBndrDoc bs = do
|
||||||
createDerivingPar
|
createDerivingPar
|
||||||
:: HsDeriving GhcPs -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
|
:: HsDeriving GhcPs -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
|
||||||
createDerivingPar derivs mainDoc = do
|
createDerivingPar derivs mainDoc = do
|
||||||
case derivs of
|
docPar mainDoc
|
||||||
(L _ []) -> mainDoc
|
$ docEnsureIndent BrIndentRegular
|
||||||
(L _ types) ->
|
$ docLines
|
||||||
docPar mainDoc
|
$ docWrapNode (noLocA derivs)
|
||||||
$ docEnsureIndent BrIndentRegular
|
$ derivingClauseDoc
|
||||||
$ docLines
|
<$> derivs
|
||||||
$ docWrapNode derivs
|
|
||||||
$ derivingClauseDoc
|
|
||||||
<$> types
|
|
||||||
|
|
||||||
derivingClauseDoc :: LHsDerivingClause GhcPs -> ToBriDocM BriDocNumbered
|
derivingClauseDoc :: LHsDerivingClause GhcPs -> ToBriDocM BriDocNumbered
|
||||||
derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
||||||
(L _ []) -> docSeq []
|
(L _ (DctSingle _ t)) -> derivingClauseDoc' [t]
|
||||||
(L _ ts) ->
|
(L _ (DctMulti _ ts)) -> derivingClauseDoc' ts
|
||||||
|
where
|
||||||
|
derivingClauseDoc' [] = docSeq []
|
||||||
|
derivingClauseDoc' ts =
|
||||||
let
|
let
|
||||||
tsLength = length ts
|
tsLength = length ts
|
||||||
whenMoreThan1Type val = if tsLength > 1 then docLitS val else docLitS ""
|
whenMoreThan1Type val = if tsLength > 1 then docLitS val else docLitS ""
|
||||||
|
@ -281,7 +282,6 @@ derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
||||||
, whenMoreThan1Type ")"
|
, whenMoreThan1Type ")"
|
||||||
, rhsStrategy
|
, rhsStrategy
|
||||||
]
|
]
|
||||||
where
|
|
||||||
strategyLeftRight
|
strategyLeftRight
|
||||||
:: Located (DerivStrategy GhcPs)
|
:: Located (DerivStrategy GhcPs)
|
||||||
-> (ToBriDocM BriDocNumbered, ToBriDocM BriDocNumbered)
|
-> (ToBriDocM BriDocNumbered, ToBriDocM BriDocNumbered)
|
||||||
|
@ -293,7 +293,7 @@ derivingClauseDoc (L _ (HsDerivingClause _ext mStrategy types)) = case types of
|
||||||
( docEmpty
|
( docEmpty
|
||||||
, case viaTypes of
|
, case viaTypes of
|
||||||
XViaStrategyPs _epann (L _span (HsSig _sig _bndrs t)) ->
|
XViaStrategyPs _epann (L _span (HsSig _sig _bndrs t)) ->
|
||||||
docSeq [docWrapNode lVia $ docLitS " via", docSeparator, layoutType t]
|
docSeq [docWrapNode (reLocA lVia) $ docLitS " via", docSeparator, layoutType t]
|
||||||
)
|
)
|
||||||
|
|
||||||
docDeriving :: ToBriDocM BriDocNumbered
|
docDeriving :: ToBriDocM BriDocNumbered
|
||||||
|
@ -426,9 +426,9 @@ createForallDoc lhsTyVarBndrs =
|
||||||
|
|
||||||
createNamesAndTypeDoc
|
createNamesAndTypeDoc
|
||||||
:: Data.Data.Data ast
|
:: Data.Data.Data ast
|
||||||
=> Located ast
|
=> LocatedAn an1 ast
|
||||||
-> [GenLocated t (FieldOcc GhcPs)]
|
-> [GenLocated t (FieldOcc GhcPs)]
|
||||||
-> Located (HsType GhcPs)
|
-> LocatedAn an2 (HsType GhcPs)
|
||||||
-> (ToBriDocM BriDocNumbered, ToBriDocM BriDocNumbered)
|
-> (ToBriDocM BriDocNumbered, ToBriDocM BriDocNumbered)
|
||||||
createNamesAndTypeDoc lField names t =
|
createNamesAndTypeDoc lField names t =
|
||||||
( docNodeAnnKW lField Nothing $ docWrapNodePrior lField $ docSeq
|
( docNodeAnnKW lField Nothing $ docWrapNodePrior lField $ docSeq
|
||||||
|
|
Loading…
Reference in New Issue