Fix infix matches with more than 2 args, fixes #219

remotes/felixonmars/release
Lennart Spitzner 2019-09-19 00:48:45 +02:00
parent 6879436e67
commit 0795a39806
2 changed files with 28 additions and 5 deletions

View File

@ -330,6 +330,15 @@ x *** y = x
#test symbol prefix #test symbol prefix
(***) x y = x (***) x y = x
#test infix more args simple
(f >=> g) k = f k >>= g
#test infix more args alignment
(Left a <$$> Left dd) e f = True
(Left a <$$> Right d ) e f = True
(Right a <$$> Left d ) e f = False
(Right a <$$> Right dd) e f = True
############################################################################### ###############################################################################
############################################################################### ###############################################################################

View File

@ -341,11 +341,25 @@ layoutPatternBind funId binderDoc lmatch@(L _ match) = do
_ -> pure Nothing _ -> pure Nothing
let mIdStr' = fixPatternBindIdentifier match <$> mIdStr let mIdStr' = fixPatternBindIdentifier match <$> mIdStr
patDoc <- docWrapNodePrior lmatch $ case (mIdStr', patDocs) of patDoc <- docWrapNodePrior lmatch $ case (mIdStr', patDocs) of
(Just idStr, p1 : pr) | isInfix -> docCols (Just idStr, p1:p2:pr) | isInfix -> if null pr
ColPatternsFuncInfix then
( [appSep $ docForceSingleline p1, appSep $ docLit idStr] docCols ColPatternsFuncInfix
++ (spacifyDocs $ docForceSingleline <$> pr) [ appSep $ docForceSingleline p1
) , appSep $ docLit $ idStr
, docForceSingleline p2
]
else
docCols ColPatternsFuncInfix
( [docCols ColPatterns
[ docParenL
, appSep $ docForceSingleline p1
, appSep $ docLit $ idStr
, docForceSingleline p2
, appSep $ docParenR
]
]
++ (spacifyDocs $ docForceSingleline <$> pr)
)
(Just idStr, []) -> docLit idStr (Just idStr, []) -> docLit idStr
(Just idStr, ps) -> (Just idStr, ps) ->
docCols ColPatternsFuncPrefix docCols ColPatternsFuncPrefix