module Language.Haskell.Brittany.Internal.Layouters.IE
  ( layoutIE
  , layoutLLIEs
  , layoutAnnAndSepLLIEs
  )
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
                         )
#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
      )
    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 [LIEWrappedName (IdP GhcPs)]
[GenLocated SrcSpan (IEWrappedName RdrName)]
ns)
        [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 [LIEWrappedName (IdP GhcPs)]
[GenLocated SrcSpan (IEWrappedName RdrName)]
ns))
   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

-- Helper function to deal with Located lists of LIEs.
-- In particular this will also associate documentation
-- from the located list that actually belongs to the last IE.
-- It also adds docCommaSep to all but the first element
-- This configuration allows both vertical and horizontal
-- handling of the resulting list. Adding parens is
-- left to the caller since that is context sensitive
layoutAnnAndSepLLIEs
  :: Located [LIE GhcPs] -> ToBriDocM [ToBriDocM BriDocNumbered]
layoutAnnAndSepLLIEs :: Located [Located (IE GhcPs)]
-> ToBriDocM
     [MultiRWST
        '[Config, Anns]
        '[[BrittanyError], Seq String]
        '[NodeAllocIndex]
        Identity
        BriDocNumbered]
layoutAnnAndSepLLIEs 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 ieDocs :: [MultiRWST
   '[Config, Anns]
   '[[BrittanyError], Seq String]
   '[NodeAllocIndex]
   Identity
   BriDocNumbered]
ieDocs = ToBriDoc IE
layoutIE 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
<$> [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 -- returned shared nodes

-- Builds a complete layout for the given located
-- list of LIEs. The layout provides two alternatives:
-- (item, item, ..., item)
-- ( item
-- , item
-- ...
-- , item
-- )
-- If the llies contains comments the list will
-- always expand over multiple lines, even when empty:
-- () -- no comments
-- ( -- a comment
-- )
layoutLLIEs :: Bool -> Located [LIE GhcPs] -> ToBriDocM BriDocNumbered
layoutLLIEs :: Bool
-> Located [Located (IE GhcPs)]
-> MultiRWST
     '[Config, Anns]
     '[[BrittanyError], Seq String]
     '[NodeAllocIndex]
     Identity
     BriDocNumbered
layoutLLIEs Bool
enableSingleline Located [Located (IE GhcPs)]
llies = do
  [MultiRWST
   '[Config, Anns]
   '[[BrittanyError], Seq String]
   '[NodeAllocIndex]
   Identity
   BriDocNumbered]
ieDs        <- Located [Located (IE GhcPs)]
-> ToBriDocM
     [MultiRWST
        '[Config, Anns]
        '[[BrittanyError], Seq String]
        '[NodeAllocIndex]
        Identity
        BriDocNumbered]
layoutAnnAndSepLLIEs 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]