Typefixing/hacking Decl (partial)

mxxun/ghc-9.2
mrkun 2022-01-31 00:43:27 +03:00
parent c201bdda16
commit 75d03534e7
4 changed files with 103 additions and 102 deletions

View File

@ -31,7 +31,7 @@ import qualified Language.Haskell.GHC.ExactPrint as ExactPrint
import qualified Language.Haskell.GHC.ExactPrint.Types as ExactPrint import qualified Language.Haskell.GHC.ExactPrint.Types as ExactPrint
import qualified System.IO import qualified System.IO
import Language.Haskell.Brittany.Internal.EPCompat
parseModule parseModule
:: [String] :: [String]
@ -50,72 +50,73 @@ parseModuleFromString
-> IO (Either String (GHC.ParsedSource, a)) -> IO (Either String (GHC.ParsedSource, a))
parseModuleFromString = ParseModule.parseModule parseModuleFromString = ParseModule.parseModule
{-
commentAnnFixTransformGlob :: SYB.Data ast => ast -> ExactPrint.Transform () commentAnnFixTransformGlob :: SYB.Data ast => ast -> ExactPrint.Transform ()
commentAnnFixTransformGlob ast = do commentAnnFixTransformGlob ast = undefined
let -- do
extract :: forall a . SYB.Data a => a -> Seq (SrcSpan, ExactPrint.AnnKey) -- let
extract = -- traceFunctionWith "extract" (show . SYB.typeOf) show $ -- extract :: forall a . SYB.Data a => a -> Seq (SrcSpan, ExactPrint.AnnKey)
const Seq.empty -- extract = -- traceFunctionWith "extract" (show . SYB.typeOf) show $
`SYB.ext1Q` (\l@(L span _) -> -- const Seq.empty
Seq.singleton (span, ExactPrint.mkAnnKey l) -- `SYB.ext1Q` (\l@(L span _) ->
) -- Seq.singleton (span, ExactPrint.mkAnnKey l)
let nodes = SYB.everything (<>) extract ast -- )
let -- let nodes = SYB.everything (<>) extract ast
annsMap :: Map GHC.RealSrcLoc ExactPrint.AnnKey -- let
annsMap = Map.fromListWith -- annsMap :: Map GHC.RealSrcLoc ExactPrint.AnnKey
(const id) -- annsMap = Map.fromListWith
[ (GHC.realSrcSpanEnd span, annKey) -- (const id)
| (GHC.RealSrcSpan span _, annKey) <- Foldable.toList nodes -- [ (GHC.realSrcSpanEnd span, annKey)
] -- | (GHC.RealSrcSpan span _, annKey) <- Foldable.toList nodes
nodes `forM_` (snd .> processComs annsMap) -- ]
where -- nodes `forM_` (snd .> processComs annsMap)
processComs annsMap annKey1 = do -- where
mAnn <- State.Class.gets fst <&> Map.lookup annKey1 -- processComs annsMap annKey1 = do
mAnn `forM_` \ann1 -> do -- mAnn <- State.Class.gets fst <&> Map.lookup annKey1
let -- mAnn `forM_` \ann1 -> do
priors = ExactPrint.annPriorComments ann1 -- let
follows = ExactPrint.annFollowingComments ann1 -- priors = ExactPrint.annPriorComments ann1
assocs = ExactPrint.annsDP ann1 -- follows = ExactPrint.annFollowingComments ann1
let -- assocs = ExactPrint.annsDP ann1
processCom -- let
:: (ExactPrint.Comment, ExactPrint.DeltaPos) -- processCom
-> ExactPrint.TransformT Identity Bool -- :: (ExactPrint.Comment, ExactPrint.DeltaPos)
processCom comPair@(com, _) = -- -> ExactPrint.TransformT Identity Bool
case GHC.realSrcSpanStart $ ExactPrint.commentIdentifier com of -- processCom comPair@(com, _) =
comLoc -> case Map.lookupLE comLoc annsMap of -- case GHC.realSrcSpanStart $ ExactPrint.commentIdentifier com of
Just (_, annKey2) | loc1 /= loc2 -> case (con1, con2) of -- comLoc -> case Map.lookupLE comLoc annsMap of
(ExactPrint.CN "RecordCon", ExactPrint.CN "HsRecField") -> -- Just (_, annKey2) | loc1 /= loc2 -> case (con1, con2) of
move $> False -- (ExactPrint.CN "RecordCon", ExactPrint.CN "HsRecField") ->
(x, y) | x == y -> move $> False -- move $> False
_ -> return True -- (x, y) | x == y -> move $> False
where -- _ -> return True
ExactPrint.AnnKey annKeyLoc1 con1 = annKey1 -- where
ExactPrint.AnnKey annKeyLoc2 con2 = annKey2 -- ExactPrint.AnnKey annKeyLoc1 con1 = annKey1
loc1 = GHC.realSrcSpanStart annKeyLoc1 -- ExactPrint.AnnKey annKeyLoc2 con2 = annKey2
loc2 = GHC.realSrcSpanStart annKeyLoc2 -- loc1 = GHC.realSrcSpanStart annKeyLoc1
move = ExactPrint.modifyAnnsT $ \anns -> -- loc2 = GHC.realSrcSpanStart annKeyLoc2
let -- move = ExactPrint.modifyAnnsT $ \anns ->
ann2 = Data.Maybe.fromJust $ Map.lookup annKey2 anns -- let
ann2' = ann2 -- ann2 = Data.Maybe.fromJust $ Map.lookup annKey2 anns
{ ExactPrint.annFollowingComments = -- ann2' = ann2
ExactPrint.annFollowingComments ann2 ++ [comPair] -- { ExactPrint.annFollowingComments =
} -- ExactPrint.annFollowingComments ann2 ++ [comPair]
in Map.insert annKey2 ann2' anns -- }
_ -> return True -- retain comment at current node. -- in Map.insert annKey2 ann2' anns
priors' <- filterM processCom priors -- _ -> return True -- retain comment at current node.
follows' <- filterM processCom follows -- priors' <- filterM processCom priors
assocs' <- flip filterM assocs $ \case -- follows' <- filterM processCom follows
(ExactPrint.AnnComment com, dp) -> processCom (com, dp) -- assocs' <- flip filterM assocs $ \case
_ -> return True -- (ExactPrint.AnnComment com, dp) -> processCom (com, dp)
let -- _ -> return True
ann1' = ann1 -- let
{ ExactPrint.annPriorComments = priors' -- ann1' = ann1
, ExactPrint.annFollowingComments = follows' -- { ExactPrint.annPriorComments = priors'
, ExactPrint.annsDP = assocs' -- , ExactPrint.annFollowingComments = follows'
} -- , ExactPrint.annsDP = assocs'
ExactPrint.modifyAnnsT $ \anns -> Map.insert annKey1 ann1' anns -- }
-} -- ExactPrint.modifyAnnsT $ \anns -> Map.insert annKey1 ann1' anns
-- TODO: this is unused by now, but it contains one detail that -- TODO: this is unused by now, but it contains one detail that
-- commentAnnFixTransformGlob does not include: Moving of comments for -- commentAnnFixTransformGlob does not include: Moving of comments for
@ -232,12 +233,12 @@ foldedAnnKeys ast = SYB.everything
where locTyCon = SYB.typeRepTyCon (SYB.typeOf (L () ())) where locTyCon = SYB.typeRepTyCon (SYB.typeOf (L () ()))
-} -}
{-
withTransformedAnns withTransformedAnns
:: Data ast :: Data ast
=> ast => ast
-> MultiRWSS.MultiRWS '[Config , ExactPrint.Anns] w s a -> MultiRWSS.MultiRWS '[Config , Anns] w s a
-> MultiRWSS.MultiRWS '[Config , ExactPrint.Anns] w s a -> MultiRWSS.MultiRWS '[Config , Anns] w s a
withTransformedAnns ast m = MultiRWSS.mGetRawR >>= \case withTransformedAnns ast m = MultiRWSS.mGetRawR >>= \case
readers@(conf :+: anns :+: HNil) -> do readers@(conf :+: anns :+: HNil) -> do
-- TODO: implement `local` for MultiReader/MultiRWS -- TODO: implement `local` for MultiReader/MultiRWS
@ -248,10 +249,10 @@ withTransformedAnns ast m = MultiRWSS.mGetRawR >>= \case
where where
f anns = f anns =
let let
((), (annsBalanced, _), _) = ((), _, _) =
ExactPrint.runTransform anns (commentAnnFixTransformGlob ast) ExactPrint.runTransform (commentAnnFixTransformGlob ast)
in annsBalanced in anns
-}
warnExtractorCompat :: GHC.Warn -> String warnExtractorCompat :: GHC.Warn -> String
warnExtractorCompat (GHC.Warn _ (L _ s)) = s warnExtractorCompat (GHC.Warn _ (L _ s)) = s

View File

@ -19,9 +19,9 @@ import GHC.Types.Basic
( Activation(..) ( Activation(..)
, InlinePragma(..) , InlinePragma(..)
, InlineSpec(..) , InlineSpec(..)
, LexicalFixity(..)
, RuleMatchInfo(..) , RuleMatchInfo(..)
) )
import GHC.Types.Fixity (LexicalFixity(..))
import GHC.Types.SrcLoc (Located, SrcSpan, getLoc, unLoc) import GHC.Types.SrcLoc (Located, SrcSpan, getLoc, unLoc)
import Language.Haskell.Brittany.Internal.Config.Types import Language.Haskell.Brittany.Internal.Config.Types
import Language.Haskell.Brittany.Internal.ExactPrintUtils import Language.Haskell.Brittany.Internal.ExactPrintUtils
@ -35,12 +35,12 @@ import Language.Haskell.Brittany.Internal.Prelude
import Language.Haskell.Brittany.Internal.PreludeUtils import Language.Haskell.Brittany.Internal.PreludeUtils
import Language.Haskell.Brittany.Internal.Types import Language.Haskell.Brittany.Internal.Types
import qualified Language.Haskell.GHC.ExactPrint as ExactPrint import qualified Language.Haskell.GHC.ExactPrint as ExactPrint
import Language.Haskell.GHC.ExactPrint.Types (mkAnnKey) -- import Language.Haskell.GHC.ExactPrint.Types (mkAnnKey)
import qualified Language.Haskell.GHC.ExactPrint.Utils as ExactPrint import qualified Language.Haskell.GHC.ExactPrint.Utils as ExactPrint
import Language.Haskell.Brittany.Internal.EPCompat
layoutDecl :: ToBriDoc an HsDecl
layoutDecl :: ToBriDoc HsDecl
layoutDecl d@(L loc decl) = case decl of layoutDecl d@(L loc decl) = case decl of
SigD _ sig -> withTransformedAnns d $ layoutSig (L loc sig) SigD _ sig -> withTransformedAnns d $ layoutSig (L loc sig)
ValD _ bind -> withTransformedAnns d $ layoutBind (L loc bind) >>= \case ValD _ bind -> withTransformedAnns d $ layoutBind (L loc bind) >>= \case
@ -57,9 +57,9 @@ layoutDecl d@(L loc decl) = case decl of
-- Sig -- Sig
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
layoutSig :: ToBriDoc Sig layoutSig :: ToBriDoc an Sig
layoutSig lsig@(L _loc sig) = case sig of layoutSig lsig@(L _loc sig) = case sig of
TypeSig _ names (HsWC _ (HsIB _ typ)) -> layoutNamesAndType Nothing names typ TypeSig _ names (HsWC _ (L _ typ)) -> layoutNamesAndType Nothing names typ
InlineSig _ name (InlinePragma _ spec _arity phaseAct conlike) -> InlineSig _ name (InlinePragma _ spec _arity phaseAct conlike) ->
docWrapNode lsig $ do docWrapNode lsig $ do
nameStr <- lrdrNameToTextAnn name nameStr <- lrdrNameToTextAnn name
@ -80,8 +80,8 @@ layoutSig lsig@(L _loc sig) = case sig of
$ Text.pack ("{-# " ++ specStr ++ conlikeStr ++ phaseStr) $ Text.pack ("{-# " ++ specStr ++ conlikeStr ++ phaseStr)
<> nameStr <> nameStr
<> Text.pack " #-}" <> Text.pack " #-}"
ClassOpSig _ False names (HsIB _ typ) -> layoutNamesAndType Nothing names typ ClassOpSig _ False names (L _ typ) -> layoutNamesAndType Nothing names typ
PatSynSig _ names (HsIB _ typ) -> PatSynSig _ names (L _ typ) ->
layoutNamesAndType (Just "pattern") names typ layoutNamesAndType (Just "pattern") names typ
_ -> briDocByExactNoComment lsig -- TODO _ -> briDocByExactNoComment lsig -- TODO
where where
@ -121,12 +121,12 @@ layoutSig lsig@(L _loc sig) = case sig of
specStringCompat specStringCompat
:: MonadMultiWriter [BrittanyError] m => LSig GhcPs -> InlineSpec -> m String :: MonadMultiWriter [BrittanyError] m => LSig GhcPs -> InlineSpec -> m String
specStringCompat ast = \case specStringCompat ast = \case
NoUserInline -> mTell [ErrorUnknownNode "NoUserInline" ast] $> "" NoUserInlinePrag -> mTell [ErrorUnknownNode "NoUserInline" ast] $> ""
Inline -> pure "INLINE " Inline -> pure "INLINE "
Inlinable -> pure "INLINABLE " Inlinable -> pure "INLINABLE "
NoInline -> pure "NOINLINE " NoInline -> pure "NOINLINE "
layoutGuardLStmt :: ToBriDoc' (Stmt GhcPs (LHsExpr GhcPs)) layoutGuardLStmt :: ToBriDoc' an (Stmt GhcPs (LHsExpr GhcPs))
layoutGuardLStmt lgstmt@(L _ stmtLR) = docWrapNode lgstmt $ case stmtLR of layoutGuardLStmt lgstmt@(L _ stmtLR) = docWrapNode lgstmt $ case stmtLR of
BodyStmt _ body _ _ -> layoutExpr body BodyStmt _ body _ _ -> layoutExpr body
BindStmt _ lPat expr -> do BindStmt _ lPat expr -> do
@ -145,7 +145,7 @@ layoutGuardLStmt lgstmt@(L _ stmtLR) = docWrapNode lgstmt $ case stmtLR of
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
layoutBind layoutBind
:: ToBriDocC (HsBindLR GhcPs GhcPs) (Either [BriDocNumbered] BriDocNumbered) :: ToBriDocC an (HsBindLR GhcPs GhcPs) (Either [BriDocNumbered] BriDocNumbered)
layoutBind lbind@(L _ bind) = case bind of layoutBind lbind@(L _ bind) = case bind of
FunBind _ fId (MG _ lmatches@(L _ matches) _) [] -> do FunBind _ fId (MG _ lmatches@(L _ matches) _) [] -> do
idStr <- lrdrNameToTextAnn fId idStr <- lrdrNameToTextAnn fId
@ -173,7 +173,7 @@ layoutBind lbind@(L _ bind) = case bind of
PatSynBind _ (PSB _ patID lpat rpat dir) -> do PatSynBind _ (PSB _ patID lpat rpat dir) -> do
fmap Right $ docWrapNode lbind $ layoutPatSynBind patID lpat dir rpat fmap Right $ docWrapNode lbind $ layoutPatSynBind patID lpat dir rpat
_ -> Right <$> unknownNodeError "" lbind _ -> Right <$> unknownNodeError "" lbind
layoutIPBind :: ToBriDoc IPBind layoutIPBind :: ToBriDoc an IPBind
layoutIPBind lipbind@(L _ bind) = case bind of layoutIPBind lipbind@(L _ bind) = case bind of
IPBind _ (Right _) _ -> error "brittany internal error: IPBind Right" IPBind _ (Right _) _ -> error "brittany internal error: IPBind Right"
IPBind _ (Left (L _ (HsIPName name))) expr -> do IPBind _ (Left (L _ (HsIPName name))) expr -> do
@ -198,7 +198,7 @@ bindOrSigtoSrcSpan (BagBind (L l _)) = l
bindOrSigtoSrcSpan (BagSig (L l _)) = l bindOrSigtoSrcSpan (BagSig (L l _)) = l
layoutLocalBinds layoutLocalBinds
:: ToBriDocC (HsLocalBindsLR GhcPs GhcPs) (Maybe [BriDocNumbered]) :: ToBriDocC an (HsLocalBindsLR GhcPs GhcPs) (Maybe [BriDocNumbered])
layoutLocalBinds lbinds@(L _ binds) = case binds of layoutLocalBinds lbinds@(L _ binds) = case binds of
-- HsValBinds (ValBindsIn lhsBindsLR []) -> -- HsValBinds (ValBindsIn lhsBindsLR []) ->
-- Just . (>>= either id return) . Data.Foldable.toList <$> mapBagM layoutBind lhsBindsLR -- TODO: fix ordering -- Just . (>>= either id return) . Data.Foldable.toList <$> mapBagM layoutBind lhsBindsLR -- TODO: fix ordering
@ -307,7 +307,7 @@ layoutPatternBindFinal
-> BriDocNumbered -> BriDocNumbered
-> Maybe BriDocNumbered -> Maybe BriDocNumbered
-> [([BriDocNumbered], BriDocNumbered, LHsExpr GhcPs)] -> [([BriDocNumbered], BriDocNumbered, LHsExpr GhcPs)]
-> Maybe (ExactPrint.AnnKey, [BriDocNumbered]) -> Maybe (AnnKey, [BriDocNumbered])
-- ^ AnnKey for the node that contains the AnnWhere position annotation -- ^ AnnKey for the node that contains the AnnWhere position annotation
-> Bool -> Bool
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
@ -663,10 +663,10 @@ layoutPatSynBind name patSynDetails patDir rpat = do
-- | Helper method for the left hand side of a pattern synonym -- | Helper method for the left hand side of a pattern synonym
layoutLPatSyn layoutLPatSyn
:: Located (IdP GhcPs) :: LocatedAn an (IdP GhcPs)
-> HsPatSynDetails (Located (IdP GhcPs)) -> HsPatSynDetails (Located (IdP GhcPs))
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
layoutLPatSyn name (PrefixCon vars) = do layoutLPatSyn name (PrefixCon _ vars) = do
docName <- lrdrNameToTextAnn name docName <- lrdrNameToTextAnn name
names <- mapM lrdrNameToTextAnn vars names <- mapM lrdrNameToTextAnn vars
docSeq . fmap appSep $ docLit docName : (docLit <$> names) docSeq . fmap appSep $ docLit docName : (docLit <$> names)
@ -699,7 +699,7 @@ layoutPatSynWhere hs = case hs of
-- TyClDecl -- TyClDecl
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
layoutTyCl :: ToBriDoc TyClDecl layoutTyCl :: ToBriDoc an TyClDecl
layoutTyCl ltycl@(L _loc tycl) = case tycl of layoutTyCl ltycl@(L _loc tycl) = case tycl of
SynDecl _ name vars fixity typ -> do SynDecl _ name vars fixity typ -> do
let let
@ -720,7 +720,7 @@ layoutTyCl ltycl@(L _loc tycl) = case tycl of
layoutSynDecl layoutSynDecl
:: Bool :: Bool
-> (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered) -> (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> Located (IdP GhcPs) -> LocatedAn an (IdP GhcPs)
-> [LHsTyVarBndr () GhcPs] -> [LHsTyVarBndr () GhcPs]
-> LHsType GhcPs -> LHsType GhcPs
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
@ -756,7 +756,7 @@ layoutSynDecl isInfix wrapNodeRest name vars typ = do
hasComments <- hasAnyCommentsConnected typ hasComments <- hasAnyCommentsConnected typ
layoutLhsAndType hasComments sharedLhs "=" typeDoc layoutLhsAndType hasComments sharedLhs "=" typeDoc
layoutTyVarBndr :: Bool -> ToBriDoc (HsTyVarBndr ()) layoutTyVarBndr :: Bool -> ToBriDoc an (HsTyVarBndr ())
layoutTyVarBndr needsSep lbndr@(L _ bndr) = do layoutTyVarBndr needsSep lbndr@(L _ bndr) = do
docWrapNodePrior lbndr $ case bndr of docWrapNodePrior lbndr $ case bndr of
UserTyVar _ _ name -> do UserTyVar _ _ name -> do
@ -783,12 +783,12 @@ layoutTyVarBndr needsSep lbndr@(L _ bndr) = do
layoutTyFamInstDecl layoutTyFamInstDecl
:: Data.Data.Data a :: Data.Data.Data a
=> Bool => Bool
-> Located a -> LocatedAn an a
-> TyFamInstDecl GhcPs -> TyFamInstDecl GhcPs
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
layoutTyFamInstDecl inClass outerNode tfid = do layoutTyFamInstDecl inClass outerNode tfid = do
let let
FamEqn _ name bndrsMay pats _fixity typ = hsib_body $ tfid_eqn tfid FamEqn _ name bndrsMay pats _fixity typ = L_body $ tfid_eqn tfid
-- bndrsMay isJust e.g. with -- bndrsMay isJust e.g. with
-- type instance forall a . MyType (Maybe a) = Either () a -- type instance forall a . MyType (Maybe a) = Either () a
innerNode = outerNode innerNode = outerNode
@ -842,7 +842,7 @@ layoutHsTyPats pats = pats <&> \case
-- Layout signatures and bindings using the corresponding layouters from the -- Layout signatures and bindings using the corresponding layouters from the
-- top-level. Layout the instance head, type family instances, and data family -- top-level. Layout the instance head, type family instances, and data family
-- instances using ExactPrint. -- instances using ExactPrint.
layoutClsInst :: ToBriDoc ClsInstDecl layoutClsInst :: ToBriDoc an ClsInstDecl
layoutClsInst lcid@(L _ cid) = docLines layoutClsInst lcid@(L _ cid) = docLines
[ layoutInstanceHead [ layoutInstanceHead
, docEnsureIndent BrIndentRegular , docEnsureIndent BrIndentRegular
@ -880,10 +880,10 @@ layoutClsInst lcid@(L _ cid) = docLines
. List.sortOn (ExactPrint.rs . getLoc) . List.sortOn (ExactPrint.rs . getLoc)
=<< sequence l =<< sequence l
layoutAndLocateSig :: ToBriDocC (Sig GhcPs) (Located BriDocNumbered) layoutAndLocateSig :: ToBriDocC an (Sig GhcPs) (Located BriDocNumbered)
layoutAndLocateSig lsig@(L loc _) = L loc <$> layoutSig lsig layoutAndLocateSig lsig@(L loc _) = L loc <$> layoutSig lsig
layoutAndLocateBind :: ToBriDocC (HsBind GhcPs) (Located BriDocNumbered) layoutAndLocateBind :: ToBriDocC an (HsBind GhcPs) (Located BriDocNumbered)
layoutAndLocateBind lbind@(L loc _) = layoutAndLocateBind lbind@(L loc _) =
L loc <$> (joinBinds =<< layoutBind lbind) L loc <$> (joinBinds =<< layoutBind lbind)
@ -894,17 +894,17 @@ layoutClsInst lcid@(L _ cid) = docLines
Right n -> return n Right n -> return n
layoutAndLocateTyFamInsts layoutAndLocateTyFamInsts
:: ToBriDocC (TyFamInstDecl GhcPs) (Located BriDocNumbered) :: ToBriDocC an (TyFamInstDecl GhcPs) (Located BriDocNumbered)
layoutAndLocateTyFamInsts ltfid@(L loc tfid) = layoutAndLocateTyFamInsts ltfid@(L loc tfid) =
L loc <$> layoutTyFamInstDecl True ltfid tfid L loc <$> layoutTyFamInstDecl True ltfid tfid
layoutAndLocateDataFamInsts layoutAndLocateDataFamInsts
:: ToBriDocC (DataFamInstDecl GhcPs) (Located BriDocNumbered) :: ToBriDocC an (DataFamInstDecl GhcPs) (Located BriDocNumbered)
layoutAndLocateDataFamInsts ldfid@(L loc _) = layoutAndLocateDataFamInsts ldfid@(L loc _) =
L loc <$> layoutDataFamInstDecl ldfid L loc <$> layoutDataFamInstDecl ldfid
-- | Send to ExactPrint then remove unecessary whitespace -- | Send to ExactPrint then remove unecessary whitespace
layoutDataFamInstDecl :: ToBriDoc DataFamInstDecl layoutDataFamInstDecl :: ToBriDoc an DataFamInstDecl
layoutDataFamInstDecl ldfid = layoutDataFamInstDecl ldfid =
fmap stripWhitespace <$> briDocByExactNoComment ldfid fmap stripWhitespace <$> briDocByExactNoComment ldfid

View File

@ -7,4 +7,4 @@ import Language.Haskell.Brittany.Internal.Types
layoutStmt :: ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs)) layoutStmt :: ToBriDoc' an (StmtLR GhcPs GhcPs (LHsExpr GhcPs))

View File

@ -221,7 +221,7 @@ type ToBriDocM = MultiRWSS.MultiRWS
type ToBriDoc an (sym :: Kind.Type -> Kind.Type) = LocatedAn an (sym GhcPs) -> ToBriDocM BriDocNumbered type ToBriDoc an (sym :: Kind.Type -> Kind.Type) = LocatedAn an (sym GhcPs) -> ToBriDocM BriDocNumbered
type ToBriDoc' an sym = LocatedAn an sym -> ToBriDocM BriDocNumbered type ToBriDoc' an sym = LocatedAn an sym -> ToBriDocM BriDocNumbered
type ToBriDocC sym c = Located sym -> ToBriDocM c type ToBriDocC an sym c = LocatedAn an sym -> ToBriDocM c
data DocMultiLine data DocMultiLine
= MultiLineNo = MultiLineNo