Improve vertical alignment

pull/132/head
Sergey Vinokurov 2018-03-30 10:51:37 +01:00
parent 0dad5051df
commit 226da07815
No known key found for this signature in database
GPG Key ID: D6CD29530F98D6B8
1 changed files with 9 additions and 9 deletions

View File

@ -106,7 +106,7 @@ layoutExpr lexpr@(L _ expr) = do
#else /* ghc-8.0 */ #else /* ghc-8.0 */
HsLamCase _ (MG lmatches@(L _ matches) _ _ _) -> do HsLamCase _ (MG lmatches@(L _ matches) _ _ _) -> do
#endif #endif
binderDoc <- docLit $ Text.pack "->" binderDoc <- docLit $ Text.pack "->"
funcPatDocs <- docWrapNode lmatches $ layoutPatternBind Nothing binderDoc `mapM` matches funcPatDocs <- docWrapNode lmatches $ layoutPatternBind Nothing binderDoc `mapM` matches
docSetParSpacing $ docAddBaseY BrIndentRegular $ docPar docSetParSpacing $ docAddBaseY BrIndentRegular $ docPar
(docLit $ Text.pack "\\case") (docLit $ Text.pack "\\case")
@ -114,8 +114,8 @@ layoutExpr lexpr@(L _ expr) = do
HsApp exp1@(L _ HsApp{}) exp2 -> do HsApp exp1@(L _ HsApp{}) exp2 -> do
let gather :: [LHsExpr RdrName] -> LHsExpr RdrName -> (LHsExpr RdrName, [LHsExpr RdrName]) let gather :: [LHsExpr RdrName] -> LHsExpr RdrName -> (LHsExpr RdrName, [LHsExpr RdrName])
gather list = \case gather list = \case
(L _ (HsApp l r)) -> gather (r:list) l L _ (HsApp l r) -> gather (r:list) l
x -> (x, list) x -> (x, list)
let (headE, paramEs) = gather [exp2] exp1 let (headE, paramEs) = gather [exp2] exp1
let colsOrSequence = case headE of let colsOrSequence = case headE of
L _ (HsVar (L _ (Unqual occname))) -> L _ (HsVar (L _ (Unqual occname))) ->
@ -230,8 +230,8 @@ layoutExpr lexpr@(L _ expr) = do
| xD <- docSharedWrapper layoutExpr x | xD <- docSharedWrapper layoutExpr x
, yD <- docSharedWrapper layoutExpr y , yD <- docSharedWrapper layoutExpr y
] ]
opLastDoc <- docSharedWrapper layoutExpr expOp opLastDoc <- docSharedWrapper layoutExpr expOp
expLastDoc <- docSharedWrapper layoutExpr expRight expLastDoc <- docSharedWrapper layoutExpr expRight
hasComments <- hasAnyCommentsBelow lexpr hasComments <- hasAnyCommentsBelow lexpr
let allowPar = case (expOp, expRight) of let allowPar = case (expOp, expRight) of
(L _ (HsVar (L _ (Unqual occname))), _) (L _ (HsVar (L _ (Unqual occname))), _)
@ -1090,10 +1090,10 @@ litBriDoc = \case
HsWordPrim (SourceText t) _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i HsWordPrim (SourceText t) _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
HsInt64Prim (SourceText t) _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i HsInt64Prim (SourceText t) _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
HsWord64Prim (SourceText t) _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i HsWord64Prim (SourceText t) _i -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
HsInteger (SourceText t) _i _type -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i HsInteger (SourceText t) _i _type -> BDFLit $ Text.pack t -- BDFLit $ Text.pack $ show i
HsRat (FL t _) _type -> BDFLit $ Text.pack t HsRat (FL t _) _type -> BDFLit $ Text.pack t
HsFloatPrim (FL t _) -> BDFLit $ Text.pack t HsFloatPrim (FL t _) -> BDFLit $ Text.pack t
HsDoublePrim (FL t _) -> BDFLit $ Text.pack t HsDoublePrim (FL t _) -> BDFLit $ Text.pack t
_ -> error "litBriDoc: literal with no SourceText" _ -> error "litBriDoc: literal with no SourceText"
overLitValBriDoc :: OverLitVal -> BriDocFInt overLitValBriDoc :: OverLitVal -> BriDocFInt