Prepare implementation for `IndentPolicyLeft`
parent
fdd2f5f6dc
commit
4568bd3553
|
@ -191,7 +191,7 @@ data IndentPolicy = IndentPolicyLeft -- never create a new indentation at more
|
|||
| IndentPolicyFree -- can create new indentations whereever
|
||||
| IndentPolicyMultiple -- can create indentations only
|
||||
-- at any n * amount.
|
||||
deriving (Show, Generic, Data)
|
||||
deriving (Eq, Show, Generic, Data)
|
||||
|
||||
data AltChooser = AltChooserSimpleQuick -- always choose last alternative.
|
||||
-- leads to tons of sparsely filled
|
||||
|
|
|
@ -13,6 +13,7 @@ where
|
|||
|
||||
import Language.Haskell.Brittany.Internal.Types
|
||||
import Language.Haskell.Brittany.Internal.LayouterBasics
|
||||
import Language.Haskell.Brittany.Internal.Config.Types
|
||||
|
||||
import RdrName ( RdrName(..) )
|
||||
import GHC ( runGhc, GenLocated(L), moduleNameString, AnnKeywordId(..) )
|
||||
|
@ -30,7 +31,8 @@ import Language.Haskell.Brittany.Internal.Layouters.Type
|
|||
|
||||
|
||||
layoutExpr :: ToBriDoc HsExpr
|
||||
layoutExpr lexpr@(L _ expr) = docWrapNode lexpr $ case expr of
|
||||
layoutExpr lexpr@(L _ expr) = do
|
||||
docWrapNode lexpr $ case expr of
|
||||
HsVar vname -> do
|
||||
docLit =<< lrdrNameToTextAnn vname
|
||||
HsUnboundVar var -> case var of
|
||||
|
|
|
@ -26,7 +26,8 @@ import {-# SOURCE #-} Language.Haskell.Brittany.Internal.Layouters.Expr
|
|||
|
||||
|
||||
layoutStmt :: ToBriDoc' (StmtLR RdrName RdrName (LHsExpr RdrName))
|
||||
layoutStmt lstmt@(L _ stmt) = docWrapNode lstmt $ case stmt of
|
||||
layoutStmt lstmt@(L _ stmt) = do
|
||||
docWrapNode lstmt $ case stmt of
|
||||
LastStmt body False _ -> do
|
||||
layoutExpr body
|
||||
BindStmt lPat expr _ _ _ -> do
|
||||
|
@ -57,8 +58,8 @@ layoutStmt lstmt@(L _ stmt) = docWrapNode lstmt $ case stmt of
|
|||
[ appSep $ docLit $ Text.pack "let"
|
||||
, docSetBaseAndIndent $ return bindDoc
|
||||
]
|
||||
, docAddBaseY BrIndentRegular
|
||||
$ docPar (docLit $ Text.pack "let")
|
||||
, docAddBaseY BrIndentRegular $ docPar
|
||||
(docLit $ Text.pack "let")
|
||||
(docSetBaseAndIndent $ return bindDoc)
|
||||
]
|
||||
Just bindDocs -> docAlt
|
||||
|
|
Loading…
Reference in New Issue