module Language.Haskell.Brittany.Internal.Layouters.IE
( layoutIE
, layoutLLIEs
, layoutAnnAndSepLLIEs
, SortItemsFlag(..)
)
where
#include "prelude.inc"
import Language.Haskell.Brittany.Internal.Types
import Language.Haskell.Brittany.Internal.LayouterBasics
import Language.Haskell.Brittany.Internal.Config.Types
import GHC ( unLoc
, runGhc
, GenLocated(L)
, moduleNameString
, AnnKeywordId(..)
, Located
, ModuleName
)
#if MIN_VERSION_ghc(8,10,1) /* ghc-8.10.1 */
import GHC.Hs
import GHC.Hs.ImpExp
#else
import HsSyn
import HsImpExp
#endif
import Name
import FieldLabel
import qualified FastString
import BasicTypes
import Language.Haskell.Brittany.Internal.Utils
prepareName :: LIEWrappedName name -> Located name
prepareName :: LIEWrappedName name -> Located name
prepareName = LIEWrappedName name -> Located name
forall name. LIEWrappedName name -> Located name
ieLWrappedName
layoutIE :: ToBriDoc IE
layoutIE :: ToBriDoc IE
layoutIE lie :: Located (IE GhcPs)
lie@(L SrcSpan
_ IE GhcPs
ie) = Located (IE GhcPs)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNode Located (IE GhcPs)
lie (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ case IE GhcPs
ie of
IEVar XIEVar GhcPs
_ LIEWrappedName (IdP GhcPs)
x -> Located (IE GhcPs)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall p l.
p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped Located (IE GhcPs)
lie LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x
IEThingAbs XIEThingAbs GhcPs
_ LIEWrappedName (IdP GhcPs)
x -> Located (IE GhcPs)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall p l.
p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped Located (IE GhcPs)
lie LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x
IEThingAll XIEThingAll GhcPs
_ LIEWrappedName (IdP GhcPs)
x -> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [Located (IE GhcPs)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall p l.
p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped Located (IE GhcPs)
lie LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x, Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"(..)"]
IEThingWith XIEThingWith GhcPs
_ LIEWrappedName (IdP GhcPs)
x (IEWildcard Int
_) [LIEWrappedName (IdP GhcPs)]
_ [Located (FieldLbl (IdP GhcPs))]
_ ->
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [Located (IE GhcPs)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall p l.
p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped Located (IE GhcPs)
lie LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x, Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"(..)"]
IEThingWith XIEThingWith GhcPs
_ LIEWrappedName (IdP GhcPs)
x IEWildcard
_ [LIEWrappedName (IdP GhcPs)]
ns [Located (FieldLbl (IdP GhcPs))]
_ -> do
Bool
hasComments <- [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
forall (m :: * -> *). Monad m => [m Bool] -> m Bool
orM
( Located (IE GhcPs)
-> AnnKeywordId
-> AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
forall ast.
Data ast =>
Located ast
-> AnnKeywordId
-> AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
hasCommentsBetween Located (IE GhcPs)
lie AnnKeywordId
AnnOpenP AnnKeywordId
AnnCloseP
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool]
forall a. a -> [a] -> [a]
: GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
forall ast.
Data ast =>
Located ast
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
hasAnyCommentsBelow LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool]
forall a. a -> [a] -> [a]
: (GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool)
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
forall ast.
Data ast =>
Located ast
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
hasAnyCommentsBelow [LIEWrappedName (IdP GhcPs)]
[GenLocated SrcSpan (IEWrappedName RdrName)]
ns
)
let sortedNs :: [GenLocated SrcSpan (IEWrappedName RdrName)]
sortedNs = (GenLocated SrcSpan (IEWrappedName RdrName) -> Text)
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
forall b a. Ord b => (a -> b) -> [a] -> [a]
List.sortOn GenLocated SrcSpan (IEWrappedName RdrName) -> Text
wrappedNameToText [LIEWrappedName (IdP GhcPs)]
[GenLocated SrcSpan (IEWrappedName RdrName)]
ns
CollectAltM ()
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
runFilteredAlternative (CollectAltM ()
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> CollectAltM ()
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ do
Bool
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
addAlternativeCond (Bool -> Bool
not Bool
hasComments)
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ())
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq
([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [Located (IE GhcPs)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall p l.
p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped Located (IE GhcPs)
lie LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x, Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"("]
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. a -> [a] -> [a]
intersperse MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docCommaSep ((GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
nameDoc [GenLocated SrcSpan (IEWrappedName RdrName)]
sortedNs)
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR]
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
addAlternative
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ())
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ Located (IE GhcPs)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNodeRest Located (IE GhcPs)
lie
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ BrIndent
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docPar
(Located (IE GhcPs)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall p l.
p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped Located (IE GhcPs)
lie LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
x)
(FirstLastView (GenLocated SrcSpan (IEWrappedName RdrName))
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutItems ([GenLocated SrcSpan (IEWrappedName RdrName)]
-> FirstLastView (GenLocated SrcSpan (IEWrappedName RdrName))
forall a. [a] -> FirstLastView a
splitFirstLast [GenLocated SrcSpan (IEWrappedName RdrName)]
sortedNs))
where
nameDoc :: GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
nameDoc = (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> (GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Located RdrName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
forall (m :: * -> *).
(MonadMultiReader Config m, MonadMultiReader Anns m) =>
Located RdrName -> m Text
lrdrNameToTextAnn (Located RdrName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text)
-> (GenLocated SrcSpan (IEWrappedName RdrName) -> Located RdrName)
-> GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpan (IEWrappedName RdrName) -> Located RdrName
forall name. LIEWrappedName name -> Located name
prepareName
layoutItem :: GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutItem GenLocated SrcSpan (IEWrappedName RdrName)
n = [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docCommaSep, GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNode GenLocated SrcSpan (IEWrappedName RdrName)
n (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
nameDoc GenLocated SrcSpan (IEWrappedName RdrName)
n]
layoutItems :: FirstLastView (GenLocated SrcSpan (IEWrappedName RdrName))
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutItems FirstLastView (GenLocated SrcSpan (IEWrappedName RdrName))
FirstLastEmpty = MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSetBaseY (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLines
[[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenLSep, Located (IE GhcPs)
-> Maybe AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall ast.
Data ast =>
Located ast
-> Maybe AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docNodeAnnKW Located (IE GhcPs)
lie (AnnKeywordId -> Maybe AnnKeywordId
forall a. a -> Maybe a
Just AnnKeywordId
AnnOpenP) MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docEmpty], MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR]
layoutItems (FirstLastSingleton GenLocated SrcSpan (IEWrappedName RdrName)
n) = MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSetBaseY (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLines
[[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenLSep, Located (IE GhcPs)
-> Maybe AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall ast.
Data ast =>
Located ast
-> Maybe AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docNodeAnnKW Located (IE GhcPs)
lie (AnnKeywordId -> Maybe AnnKeywordId
forall a. a -> Maybe a
Just AnnKeywordId
AnnOpenP) (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
nameDoc GenLocated SrcSpan (IEWrappedName RdrName)
n], MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR]
layoutItems (FirstLast GenLocated SrcSpan (IEWrappedName RdrName)
n1 [GenLocated SrcSpan (IEWrappedName RdrName)]
nMs GenLocated SrcSpan (IEWrappedName RdrName)
nN) =
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSetBaseY
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLines
([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenLSep, GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNode GenLocated SrcSpan (IEWrappedName RdrName)
n1 (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
nameDoc GenLocated SrcSpan (IEWrappedName RdrName)
n1]]
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ (GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutItem [GenLocated SrcSpan (IEWrappedName RdrName)]
nMs
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ [[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docCommaSep, Located (IE GhcPs)
-> Maybe AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall ast.
Data ast =>
Located ast
-> Maybe AnnKeywordId
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docNodeAnnKW Located (IE GhcPs)
lie (AnnKeywordId -> Maybe AnnKeywordId
forall a. a -> Maybe a
Just AnnKeywordId
AnnOpenP) (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ GenLocated SrcSpan (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
nameDoc GenLocated SrcSpan (IEWrappedName RdrName)
nN], MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR]
IEModuleContents XIEModuleContents GhcPs
_ Located ModuleName
n -> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq
[ Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"module"
, MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeparator
, Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> (ModuleName -> Text)
-> ModuleName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (ModuleName -> String) -> ModuleName -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModuleName -> String
moduleNameString (ModuleName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> ModuleName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ Located ModuleName -> SrcSpanLess (Located ModuleName)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc Located ModuleName
n
]
IE GhcPs
_ -> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docEmpty
where
layoutWrapped :: p
-> GenLocated l (IEWrappedName RdrName)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutWrapped p
_ = \case
L l
_ (IEName Located RdrName
n) -> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Located RdrName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
forall (m :: * -> *).
(MonadMultiReader Config m, MonadMultiReader Anns m) =>
Located RdrName -> m Text
lrdrNameToTextAnn Located RdrName
n
L l
_ (IEPattern Located RdrName
n) -> do
Text
name <- Located RdrName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
forall (m :: * -> *).
(MonadMultiReader Config m, MonadMultiReader Anns m) =>
Located RdrName -> m Text
lrdrNameToTextAnn Located RdrName
n
Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"pattern " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
name
L l
_ (IEType Located RdrName
n) -> do
Text
name <- Located RdrName
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Text
forall (m :: * -> *).
(MonadMultiReader Config m, MonadMultiReader Anns m) =>
Located RdrName -> m Text
lrdrNameToTextAnn Located RdrName
n
Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"type " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
name
data SortItemsFlag = ShouldSortItems | KeepItemsUnsorted
layoutAnnAndSepLLIEs
:: SortItemsFlag -> Located [LIE GhcPs] -> ToBriDocM [ToBriDocM BriDocNumbered]
layoutAnnAndSepLLIEs :: SortItemsFlag
-> Located [Located (IE GhcPs)]
-> ToBriDocM
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
layoutAnnAndSepLLIEs SortItemsFlag
shouldSort llies :: Located [Located (IE GhcPs)]
llies@(L SrcSpan
_ [Located (IE GhcPs)]
lies) = do
let makeIENode :: MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
makeIENode MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ie = [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docCommaSep, MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ie]
let sortedLies :: [Located (IE GhcPs)]
sortedLies =
[ Located (IE GhcPs)
items
| [Located (IE GhcPs)]
group <- (Located (IE GhcPs) -> Text)
-> [Located (IE GhcPs)] -> [[Located (IE GhcPs)]]
forall b a. Eq b => (a -> b) -> [a] -> [[a]]
Data.List.Extra.groupOn Located (IE GhcPs) -> Text
lieToText
([Located (IE GhcPs)] -> [[Located (IE GhcPs)]])
-> [Located (IE GhcPs)] -> [[Located (IE GhcPs)]]
forall a b. (a -> b) -> a -> b
$ (Located (IE GhcPs) -> Text)
-> [Located (IE GhcPs)] -> [Located (IE GhcPs)]
forall b a. Ord b => (a -> b) -> [a] -> [a]
List.sortOn Located (IE GhcPs) -> Text
lieToText [Located (IE GhcPs)]
lies
, Located (IE GhcPs)
items <- [Located (IE GhcPs)] -> [Located (IE GhcPs)]
mergeGroup [Located (IE GhcPs)]
group
]
let ieDocs :: [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDocs = ToBriDoc IE
-> [Located (IE GhcPs)]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ToBriDoc IE
layoutIE ([Located (IE GhcPs)]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered])
-> [Located (IE GhcPs)]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a b. (a -> b) -> a -> b
$ case SortItemsFlag
shouldSort of
SortItemsFlag
ShouldSortItems -> [Located (IE GhcPs)]
sortedLies
SortItemsFlag
KeepItemsUnsorted -> [Located (IE GhcPs)]
lies
[BriDocNumbered]
ieCommaDocs <-
Located [Located (IE GhcPs)]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNodeRest Located [Located (IE GhcPs)]
llies (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered])
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence ([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered])
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
[BriDocNumbered]
forall a b. (a -> b) -> a -> b
$ case [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> FirstLastView
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
forall a. [a] -> FirstLastView a
splitFirstLast [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDocs of
FirstLastView
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
FirstLastEmpty -> []
FirstLastSingleton MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ie -> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ie]
FirstLast MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ie1 [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieMs MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ieN ->
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ie1] [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a b. (a -> b) -> [a] -> [b]
map MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
makeIENode [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieMs [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
makeIENode MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ieN]
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> ToBriDocM
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> ToBriDocM
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered])
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> ToBriDocM
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a b. (a -> b) -> a -> b
$ (BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall (f :: * -> *) a. Applicative f => a -> f a
pure [BriDocNumbered]
ieCommaDocs
where
mergeGroup :: [LIE GhcPs] -> [LIE GhcPs]
mergeGroup :: [Located (IE GhcPs)] -> [Located (IE GhcPs)]
mergeGroup [] = []
mergeGroup items :: [Located (IE GhcPs)]
items@[Located (IE GhcPs)
_] = [Located (IE GhcPs)]
items
mergeGroup [Located (IE GhcPs)]
items = if
| (Located (IE GhcPs) -> Bool) -> [Located (IE GhcPs)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Located (IE GhcPs) -> Bool
isProperIEThing [Located (IE GhcPs)]
items -> [(Located (IE GhcPs) -> Located (IE GhcPs) -> Located (IE GhcPs))
-> [Located (IE GhcPs)] -> Located (IE GhcPs)
forall a. (a -> a -> a) -> [a] -> a
List.foldl1' Located (IE GhcPs) -> Located (IE GhcPs) -> Located (IE GhcPs)
thingFolder [Located (IE GhcPs)]
items]
| (Located (IE GhcPs) -> Bool) -> [Located (IE GhcPs)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Located (IE GhcPs) -> Bool
isIEVar [Located (IE GhcPs)]
items -> [(Located (IE GhcPs) -> Located (IE GhcPs) -> Located (IE GhcPs))
-> [Located (IE GhcPs)] -> Located (IE GhcPs)
forall a. (a -> a -> a) -> [a] -> a
List.foldl1' Located (IE GhcPs) -> Located (IE GhcPs) -> Located (IE GhcPs)
thingFolder [Located (IE GhcPs)]
items]
| Bool
otherwise -> [Located (IE GhcPs)]
items
isProperIEThing :: LIE GhcPs -> Bool
isProperIEThing :: Located (IE GhcPs) -> Bool
isProperIEThing = \case
L SrcSpan
_ (IEThingAbs XIEThingAbs GhcPs
_ LIEWrappedName (IdP GhcPs)
_wn) -> Bool
True
L SrcSpan
_ (IEThingAll XIEThingAll GhcPs
_ LIEWrappedName (IdP GhcPs)
_wn) -> Bool
True
L SrcSpan
_ (IEThingWith XIEThingWith GhcPs
_ LIEWrappedName (IdP GhcPs)
_wn IEWildcard
NoIEWildcard [LIEWrappedName (IdP GhcPs)]
_ [Located (FieldLbl (IdP GhcPs))]
_) -> Bool
True
Located (IE GhcPs)
_ -> Bool
False
isIEVar :: LIE GhcPs -> Bool
isIEVar :: Located (IE GhcPs) -> Bool
isIEVar = \case
L SrcSpan
_ IEVar{} -> Bool
True
Located (IE GhcPs)
_ -> Bool
False
thingFolder :: LIE GhcPs -> LIE GhcPs -> LIE GhcPs
thingFolder :: Located (IE GhcPs) -> Located (IE GhcPs) -> Located (IE GhcPs)
thingFolder l1 :: Located (IE GhcPs)
l1@(L SrcSpan
_ IEVar{} ) Located (IE GhcPs)
_ = Located (IE GhcPs)
l1
thingFolder l1 :: Located (IE GhcPs)
l1@(L SrcSpan
_ IEThingAll{}) Located (IE GhcPs)
_ = Located (IE GhcPs)
l1
thingFolder Located (IE GhcPs)
_ l2 :: Located (IE GhcPs)
l2@(L SrcSpan
_ IEThingAll{}) = Located (IE GhcPs)
l2
thingFolder Located (IE GhcPs)
l1 ( L SrcSpan
_ IEThingAbs{}) = Located (IE GhcPs)
l1
thingFolder (L SrcSpan
_ IEThingAbs{}) Located (IE GhcPs)
l2 = Located (IE GhcPs)
l2
thingFolder (L SrcSpan
l (IEThingWith XIEThingWith GhcPs
x LIEWrappedName (IdP GhcPs)
wn IEWildcard
_ [LIEWrappedName (IdP GhcPs)]
consItems1 [Located (FieldLbl (IdP GhcPs))]
fieldLbls1)) (L SrcSpan
_ (IEThingWith XIEThingWith GhcPs
_ LIEWrappedName (IdP GhcPs)
_ IEWildcard
_ [LIEWrappedName (IdP GhcPs)]
consItems2 [Located (FieldLbl (IdP GhcPs))]
fieldLbls2))
= SrcSpan -> IE GhcPs -> Located (IE GhcPs)
forall l e. l -> e -> GenLocated l e
L
SrcSpan
l
(XIEThingWith GhcPs
-> LIEWrappedName (IdP GhcPs)
-> IEWildcard
-> [LIEWrappedName (IdP GhcPs)]
-> [Located (FieldLbl (IdP GhcPs))]
-> IE GhcPs
forall pass.
XIEThingWith pass
-> LIEWrappedName (IdP pass)
-> IEWildcard
-> [LIEWrappedName (IdP pass)]
-> [Located (FieldLbl (IdP pass))]
-> IE pass
IEThingWith XIEThingWith GhcPs
x
LIEWrappedName (IdP GhcPs)
wn
IEWildcard
NoIEWildcard
([LIEWrappedName (IdP GhcPs)]
[GenLocated SrcSpan (IEWrappedName RdrName)]
consItems1 [GenLocated SrcSpan (IEWrappedName RdrName)]
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
-> [GenLocated SrcSpan (IEWrappedName RdrName)]
forall a. [a] -> [a] -> [a]
++ [LIEWrappedName (IdP GhcPs)]
[GenLocated SrcSpan (IEWrappedName RdrName)]
consItems2)
([Located (FieldLbl (IdP GhcPs))]
[GenLocated SrcSpan (FieldLbl RdrName)]
fieldLbls1 [GenLocated SrcSpan (FieldLbl RdrName)]
-> [GenLocated SrcSpan (FieldLbl RdrName)]
-> [GenLocated SrcSpan (FieldLbl RdrName)]
forall a. [a] -> [a] -> [a]
++ [Located (FieldLbl (IdP GhcPs))]
[GenLocated SrcSpan (FieldLbl RdrName)]
fieldLbls2)
)
thingFolder Located (IE GhcPs)
_ Located (IE GhcPs)
_ =
String -> Located (IE GhcPs)
forall a. HasCallStack => String -> a
error String
"thingFolder should be exhaustive because we have a guard above"
layoutLLIEs :: Bool -> SortItemsFlag -> Located [LIE GhcPs] -> ToBriDocM BriDocNumbered
layoutLLIEs :: Bool
-> SortItemsFlag
-> Located [Located (IE GhcPs)]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
layoutLLIEs Bool
enableSingleline SortItemsFlag
shouldSort Located [Located (IE GhcPs)]
llies = do
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDs <- SortItemsFlag
-> Located [Located (IE GhcPs)]
-> ToBriDocM
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
layoutAnnAndSepLLIEs SortItemsFlag
shouldSort Located [Located (IE GhcPs)]
llies
Bool
hasComments <- Located [Located (IE GhcPs)]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
forall ast.
Data ast =>
Located ast
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Bool
hasAnyCommentsBelow Located [Located (IE GhcPs)]
llies
CollectAltM ()
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
runFilteredAlternative (CollectAltM ()
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> CollectAltM ()
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ case [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDs of
[] -> do
Bool
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
addAlternativeCond (Bool -> Bool
not Bool
hasComments) (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ())
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"()"
Bool
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
addAlternativeCond Bool
hasComments (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ())
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docPar
([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenLSep, Located [Located (IE GhcPs)]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNodeRest Located [Located (IE GhcPs)]
llies MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docEmpty])
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ieDsH : [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDsT) -> do
Bool
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
addAlternativeCond (Bool -> Bool
not Bool
hasComments Bool -> Bool -> Bool
&& Bool
enableSingleline)
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ())
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq
([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [Text
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLit (String -> Text
Text.pack String
"(")]
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docForceSingleline (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDs)
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR]
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
addAlternative
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ())
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docPar (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSetBaseY (MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docSeq [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenLSep, MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
ieDsH])
(MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docLines
([MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered)
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
ieDsT
[MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
-> [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered]
forall a. [a] -> [a] -> [a]
++ [MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
BriDocNumbered
docParenR]
wrappedNameToText :: LIEWrappedName RdrName -> Text
wrappedNameToText :: GenLocated SrcSpan (IEWrappedName RdrName) -> Text
wrappedNameToText = \case
L SrcSpan
_ (IEName Located RdrName
n) -> Located RdrName -> Text
forall l. GenLocated l RdrName -> Text
lrdrNameToText Located RdrName
n
L SrcSpan
_ (IEPattern Located RdrName
n) -> Located RdrName -> Text
forall l. GenLocated l RdrName -> Text
lrdrNameToText Located RdrName
n
L SrcSpan
_ (IEType Located RdrName
n) -> Located RdrName -> Text
forall l. GenLocated l RdrName -> Text
lrdrNameToText Located RdrName
n
lieToText :: LIE GhcPs -> Text
lieToText :: Located (IE GhcPs) -> Text
lieToText = \case
L SrcSpan
_ (IEVar XIEVar GhcPs
_ LIEWrappedName (IdP GhcPs)
wn ) -> GenLocated SrcSpan (IEWrappedName RdrName) -> Text
wrappedNameToText LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
wn
L SrcSpan
_ (IEThingAbs XIEThingAbs GhcPs
_ LIEWrappedName (IdP GhcPs)
wn ) -> GenLocated SrcSpan (IEWrappedName RdrName) -> Text
wrappedNameToText LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
wn
L SrcSpan
_ (IEThingAll XIEThingAll GhcPs
_ LIEWrappedName (IdP GhcPs)
wn ) -> GenLocated SrcSpan (IEWrappedName RdrName) -> Text
wrappedNameToText LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
wn
L SrcSpan
_ (IEThingWith XIEThingWith GhcPs
_ LIEWrappedName (IdP GhcPs)
wn IEWildcard
_ [LIEWrappedName (IdP GhcPs)]
_ [Located (FieldLbl (IdP GhcPs))]
_) -> GenLocated SrcSpan (IEWrappedName RdrName) -> Text
wrappedNameToText LIEWrappedName (IdP GhcPs)
GenLocated SrcSpan (IEWrappedName RdrName)
wn
L SrcSpan
_ (IEModuleContents XIEModuleContents GhcPs
_ Located ModuleName
n) -> Located ModuleName -> Text
moduleNameToText Located ModuleName
n
L SrcSpan
_ (IEGroup XIEGroup GhcPs
_ Int
_ HsDocString
_ ) -> String -> Text
Text.pack String
"@IEGroup"
L SrcSpan
_ (IEDoc XIEDoc GhcPs
_ HsDocString
_ ) -> String -> Text
Text.pack String
"@IEDoc"
L SrcSpan
_ (IEDocNamed XIEDocNamed GhcPs
_ String
_ ) -> String -> Text
Text.pack String
"@IEDocNamed"
L SrcSpan
_ (XIE XXIE GhcPs
_ ) -> String -> Text
Text.pack String
"@XIE"
where
moduleNameToText :: Located ModuleName -> Text
moduleNameToText :: Located ModuleName -> Text
moduleNameToText (L SrcSpan
_ ModuleName
name) = String -> Text
Text.pack (String
"@IEModuleContents" String -> String -> String
forall a. [a] -> [a] -> [a]
++ ModuleName -> String
moduleNameString ModuleName
name)