Share some more bridoc nodes, clean up code
parent
3631f6aec3
commit
2ce3fb178c
|
@ -747,23 +747,24 @@ layoutPatSynBind name patSynDetails patDir rpat = do
|
|||
body = colsWrapPat =<< layoutPat rpat
|
||||
whereDoc = docLit $ Text.pack "where"
|
||||
mWhereDocs <- layoutPatSynWhere patDir
|
||||
runFilteredAlternative $ do
|
||||
addAlternative $
|
||||
-- pattern .. where
|
||||
-- ..
|
||||
-- ..
|
||||
docAddBaseY BrIndentRegular $ docSeq $
|
||||
headDoc <- fmap pure $ docSeq $
|
||||
[ patDoc
|
||||
, docSeparator
|
||||
, layoutLPatSyn name patSynDetails
|
||||
, docSeparator
|
||||
, binderDoc
|
||||
, docSeparator
|
||||
, body
|
||||
] ++ case mWhereDocs of
|
||||
]
|
||||
runFilteredAlternative $ do
|
||||
addAlternative $
|
||||
-- pattern .. where
|
||||
-- ..
|
||||
-- ..
|
||||
docAddBaseY BrIndentRegular $ docSeq
|
||||
( [headDoc, docSeparator, body]
|
||||
++ case mWhereDocs of
|
||||
Just ds -> [docSeparator, docPar whereDoc (docLines ds)]
|
||||
Nothing -> []
|
||||
|
||||
)
|
||||
addAlternative $
|
||||
-- pattern .. =
|
||||
-- ..
|
||||
|
@ -772,12 +773,10 @@ layoutPatSynBind name patSynDetails patDir rpat = do
|
|||
-- ..
|
||||
-- ..
|
||||
docAddBaseY BrIndentRegular $ docPar
|
||||
(docSeq $ appSep <$> [ patDoc, layoutLPatSyn name patSynDetails, binderDoc])
|
||||
(docLines $
|
||||
case mWhereDocs of
|
||||
Nothing -> [body]
|
||||
Just ds ->
|
||||
[ docSeq [body, docSeparator, whereDoc] ] ++ ds
|
||||
headDoc
|
||||
(case mWhereDocs of
|
||||
Nothing -> body
|
||||
Just ds -> docLines ([ docSeq [body, docSeparator, whereDoc] ] ++ ds)
|
||||
)
|
||||
|
||||
-- | Helper method for the left hand side of a pattern synonym
|
||||
|
|
Loading…
Reference in New Issue