{-# LANGUAGE DataKinds #-}
module Language.Haskell.Brittany.Internal.Layouters.Stmt
( layoutStmt
)
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 ( runGhc
, GenLocated(L)
, moduleNameString
)
#if MIN_VERSION_ghc(8,10,1) /* ghc-8.10.1 */
import GHC.Hs
#else
import HsSyn
#endif
import Name
import qualified FastString
import BasicTypes
import Language.Haskell.Brittany.Internal.Layouters.Pattern
import Language.Haskell.Brittany.Internal.Layouters.Decl
import {-# SOURCE #-} Language.Haskell.Brittany.Internal.Layouters.Expr
layoutStmt :: ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
layoutStmt :: ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
layoutStmt lstmt :: Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
lstmt@(L SrcSpan
_ StmtLR GhcPs GhcPs (LHsExpr GhcPs)
stmt) = do
IndentPolicy
indentPolicy <- MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Config
forall a (m :: * -> *). MonadMultiReader a m => m a
mAsk MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Config
-> (Config -> IndentPolicy)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
IndentPolicy
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> Config -> CLayoutConfig Identity
forall (f :: * -> *). CConfig f -> CLayoutConfig f
_conf_layout (Config -> CLayoutConfig Identity)
-> (CLayoutConfig Identity -> Identity (Last IndentPolicy))
-> Config
-> Identity (Last IndentPolicy)
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> CLayoutConfig Identity -> Identity (Last IndentPolicy)
forall (f :: * -> *). CLayoutConfig f -> f (Last IndentPolicy)
_lconfig_indentPolicy (Config -> Identity (Last IndentPolicy))
-> (Identity (Last IndentPolicy) -> IndentPolicy)
-> Config
-> IndentPolicy
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> Identity (Last IndentPolicy) -> IndentPolicy
forall a b. Coercible a b => Identity a -> b
confUnpack
Int
indentAmount :: Int <-
MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Config
forall a (m :: * -> *). MonadMultiReader a m => m a
mAsk MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Config
-> (Config -> Int)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
Int
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> Config -> CLayoutConfig Identity
forall (f :: * -> *). CConfig f -> CLayoutConfig f
_conf_layout (Config -> CLayoutConfig Identity)
-> (CLayoutConfig Identity -> Identity (Last Int))
-> Config
-> Identity (Last Int)
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> CLayoutConfig Identity -> Identity (Last Int)
forall (f :: * -> *). CLayoutConfig f -> f (Last Int)
_lconfig_indentAmount (Config -> Identity (Last Int))
-> (Identity (Last Int) -> Int) -> Config -> Int
forall a b c. (a -> b) -> (b -> c) -> a -> c
.> Identity (Last Int) -> Int
forall a b. Coercible a b => Identity a -> b
confUnpack
Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a ast. (DocWrapable a, Data ast) => Located ast -> a -> a
docWrapNode Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
lstmt (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ case StmtLR GhcPs GhcPs (LHsExpr GhcPs)
stmt of
LastStmt XLastStmt GhcPs GhcPs (LHsExpr GhcPs)
_ LHsExpr GhcPs
body Bool
False SyntaxExpr GhcPs
_ -> do
ToBriDoc HsExpr
layoutExpr LHsExpr GhcPs
body
BindStmt XBindStmt GhcPs GhcPs (LHsExpr GhcPs)
_ LPat GhcPs
lPat LHsExpr GhcPs
expr SyntaxExpr GhcPs
_ SyntaxExpr GhcPs
_ -> do
ToBriDocM BriDocNumbered
patDoc <- (BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(ToBriDocM BriDocNumbered)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BriDocNumbered -> ToBriDocM BriDocNumbered
forall (m :: * -> *) a. Monad m => a -> m a
return (ToBriDocM BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(ToBriDocM BriDocNumbered))
-> ToBriDocM BriDocNumbered
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(ToBriDocM BriDocNumbered)
forall a b. (a -> b) -> a -> b
$ Seq BriDocNumbered -> ToBriDocM BriDocNumbered
colsWrapPat (Seq BriDocNumbered -> ToBriDocM BriDocNumbered)
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(Seq BriDocNumbered)
-> ToBriDocM BriDocNumbered
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< LPat GhcPs
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(Seq BriDocNumbered)
layoutPat LPat GhcPs
lPat
ToBriDocM BriDocNumbered
expDoc <- ToBriDoc HsExpr
-> LHsExpr GhcPs
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(ToBriDocM BriDocNumbered)
forall (m :: * -> *) x y. Monad m => (x -> m y) -> x -> m (m y)
docSharedWrapper ToBriDoc HsExpr
layoutExpr LHsExpr GhcPs
expr
[ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docAlt
[ ColSig -> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docCols
ColSig
ColBindStmt
[ ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
appSep ToBriDocM BriDocNumbered
patDoc
, [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docSeq
[ ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
appSep (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"<-"
, BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docForceParSpacing ToBriDocM BriDocNumbered
expDoc
]
]
, ColSig -> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docCols
ColSig
ColBindStmt
[ ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
appSep ToBriDocM BriDocNumbered
patDoc
, BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular
(ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDocM BriDocNumbered
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docPar (Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"<-") (ToBriDocM BriDocNumbered
expDoc)
]
]
LetStmt XLetStmt GhcPs GhcPs (LHsExpr GhcPs)
_ LHsLocalBindsLR GhcPs GhcPs
binds -> do
let isFree :: Bool
isFree = IndentPolicy
indentPolicy IndentPolicy -> IndentPolicy -> Bool
forall a. Eq a => a -> a -> Bool
== IndentPolicy
IndentPolicyFree
let indentFourPlus :: Bool
indentFourPlus = Int
indentAmount Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
4
ToBriDocC (HsLocalBindsLR GhcPs GhcPs) (Maybe [BriDocNumbered])
layoutLocalBinds LHsLocalBindsLR GhcPs GhcPs
binds MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(Maybe [BriDocNumbered])
-> (Maybe [BriDocNumbered] -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe [BriDocNumbered]
Nothing -> Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"let"
Just [] -> Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"let"
Just [BriDocNumbered
bindDoc] -> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docAlt
[
ColSig -> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docCols
ColSig
ColDoLet
[ ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
appSep (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"let"
, let
f :: ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
f = case IndentPolicy
indentPolicy of
IndentPolicy
IndentPolicyFree -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docSetBaseAndIndent
IndentPolicy
IndentPolicyLeft -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docForceSingleline
IndentPolicy
IndentPolicyMultiple | Bool
indentFourPlus -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docSetBaseAndIndent
| Bool
otherwise -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docForceSingleline
in ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
f (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ BriDocNumbered -> ToBriDocM BriDocNumbered
forall (m :: * -> *) a. Monad m => a -> m a
return BriDocNumbered
bindDoc
]
,
BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDocM BriDocNumbered
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docPar
(Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"let")
(ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docSetBaseAndIndent (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ BriDocNumbered -> ToBriDocM BriDocNumbered
forall (m :: * -> *) a. Monad m => a -> m a
return BriDocNumbered
bindDoc)
]
Just [BriDocNumbered]
bindDocs -> CollectAltM () -> ToBriDocM BriDocNumbered
runFilteredAlternative (CollectAltM () -> ToBriDocM BriDocNumbered)
-> CollectAltM () -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ do
Bool -> ToBriDocM BriDocNumbered -> CollectAltM ()
addAlternativeCond (Bool
isFree Bool -> Bool -> Bool
|| Bool
indentFourPlus) (ToBriDocM BriDocNumbered -> CollectAltM ())
-> ToBriDocM BriDocNumbered -> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docSeq
[ ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
appSep (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"let"
, let f :: ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
f = if Bool
indentFourPlus
then BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docEnsureIndent BrIndent
BrIndentRegular
else ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docSetBaseAndIndent
in ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
f (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docLines ([ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered)
-> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ BriDocNumbered -> ToBriDocM BriDocNumbered
forall (m :: * -> *) a. Monad m => a -> m a
return (BriDocNumbered -> ToBriDocM BriDocNumbered)
-> [BriDocNumbered] -> [ToBriDocM BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [BriDocNumbered]
bindDocs
]
Bool -> ToBriDocM BriDocNumbered -> CollectAltM ()
addAlternativeCond (Bool -> Bool
not Bool
indentFourPlus)
(ToBriDocM BriDocNumbered -> CollectAltM ())
-> ToBriDocM BriDocNumbered -> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular
(ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDocM BriDocNumbered
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docPar (Text -> ToBriDocM BriDocNumbered
docLit (Text -> ToBriDocM BriDocNumbered)
-> Text -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ String -> Text
Text.pack String
"let")
(ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docSetBaseAndIndent (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docLines ([ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered)
-> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ BriDocNumbered -> ToBriDocM BriDocNumbered
forall (m :: * -> *) a. Monad m => a -> m a
return (BriDocNumbered -> ToBriDocM BriDocNumbered)
-> [BriDocNumbered] -> [ToBriDocM BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [BriDocNumbered]
bindDocs)
RecStmt XRecStmt GhcPs GhcPs (LHsExpr GhcPs)
_ [Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))]
stmts [IdP GhcPs]
_ [IdP GhcPs]
_ SyntaxExpr GhcPs
_ SyntaxExpr GhcPs
_ SyntaxExpr GhcPs
_ -> CollectAltM () -> ToBriDocM BriDocNumbered
runFilteredAlternative (CollectAltM () -> ToBriDocM BriDocNumbered)
-> CollectAltM () -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ do
Bool -> ToBriDocM BriDocNumbered -> CollectAltM ()
addAlternativeCond (IndentPolicy
indentPolicy IndentPolicy -> IndentPolicy -> Bool
forall a. Eq a => a -> a -> Bool
== IndentPolicy
IndentPolicyFree) (ToBriDocM BriDocNumbered -> CollectAltM ())
-> ToBriDocM BriDocNumbered -> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docSeq
[ Text -> ToBriDocM BriDocNumbered
docLit (String -> Text
Text.pack String
"rec")
, ToBriDocM BriDocNumbered
docSeparator
, ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docSetBaseAndIndent (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docLines ([ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered)
-> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
layoutStmt ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
-> [Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))]
-> [ToBriDocM BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))]
stmts
]
ToBriDocM BriDocNumbered -> CollectAltM ()
addAlternative (ToBriDocM BriDocNumbered -> CollectAltM ())
-> ToBriDocM BriDocNumbered -> CollectAltM ()
forall a b. (a -> b) -> a -> b
$ BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDocM BriDocNumbered
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docPar
(Text -> ToBriDocM BriDocNumbered
docLit (String -> Text
Text.pack String
"rec"))
([ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
docLines ([ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered)
-> [ToBriDocM BriDocNumbered] -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
layoutStmt ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
-> [Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))]
-> [ToBriDocM BriDocNumbered]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))]
stmts)
BodyStmt XBodyStmt GhcPs GhcPs (LHsExpr GhcPs)
_ LHsExpr GhcPs
expr SyntaxExpr GhcPs
_ SyntaxExpr GhcPs
_ -> do
ToBriDocM BriDocNumbered
expDoc <- ToBriDoc HsExpr
-> LHsExpr GhcPs
-> MultiRWST
'[Config, Anns]
'[[BrittanyError], Seq String]
'[NodeAllocIndex]
Identity
(ToBriDocM BriDocNumbered)
forall (m :: * -> *) x y. Monad m => (x -> m y) -> x -> m (m y)
docSharedWrapper ToBriDoc HsExpr
layoutExpr LHsExpr GhcPs
expr
BrIndent -> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
docAddBaseY BrIndent
BrIndentRegular (ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered)
-> ToBriDocM BriDocNumbered -> ToBriDocM BriDocNumbered
forall a b. (a -> b) -> a -> b
$ ToBriDocM BriDocNumbered
expDoc
StmtLR GhcPs GhcPs (LHsExpr GhcPs)
_ -> String -> ToBriDoc' (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
forall ast.
(Annotate ast, Data ast) =>
String -> Located ast -> ToBriDocM BriDocNumbered
briDocByExactInlineOnly String
"some unknown statement" Located (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
lstmt