Merge pull request #82 from matthew-piziak/tuple-section-support
Tuple section support (fixes #41)pull/95/head
commit
9700fb2a50
|
@ -476,9 +476,23 @@ func = (`abc` 1)
|
||||||
#group tuples
|
#group tuples
|
||||||
###
|
###
|
||||||
|
|
||||||
#test 1
|
#test pair
|
||||||
func = (abc, def)
|
func = (abc, def)
|
||||||
|
|
||||||
|
#test pair section left
|
||||||
|
func = (abc, )
|
||||||
|
|
||||||
|
#test pair section right
|
||||||
|
func = (, abc)
|
||||||
|
|
||||||
|
#test quintuple section long
|
||||||
|
myTupleSection =
|
||||||
|
( verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargefirstelement
|
||||||
|
,
|
||||||
|
, verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargethirdelement
|
||||||
|
,
|
||||||
|
)
|
||||||
|
|
||||||
#test 2
|
#test 2
|
||||||
#pending
|
#pending
|
||||||
func = (lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
|
func = (lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
|
||||||
|
|
|
@ -341,9 +341,9 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
opDoc <- docSharedWrapper layoutExpr op
|
opDoc <- docSharedWrapper layoutExpr op
|
||||||
rightDoc <- docSharedWrapper layoutExpr right
|
rightDoc <- docSharedWrapper layoutExpr right
|
||||||
docSeq [opDoc, docSeparator, rightDoc]
|
docSeq [opDoc, docSeparator, rightDoc]
|
||||||
ExplicitTuple args boxity
|
ExplicitTuple args boxity -> do
|
||||||
| Just argExprs <- args `forM` (\case (L _ (Present e)) -> Just e; _ -> Nothing) -> do
|
let argExprs = fmap (\case (L _ (Present e)) -> Just e; (L _ (Missing PlaceHolder)) -> Nothing) args
|
||||||
argDocs <- docSharedWrapper layoutExpr `mapM` argExprs
|
argDocs <- docSharedWrapper (maybe docEmpty layoutExpr) `mapM` argExprs
|
||||||
hasComments <- hasAnyCommentsBelow lexpr
|
hasComments <- hasAnyCommentsBelow lexpr
|
||||||
let (openLit, closeLit) = case boxity of
|
let (openLit, closeLit) = case boxity of
|
||||||
Boxed -> (docLit $ Text.pack "(", docLit $ Text.pack ")")
|
Boxed -> (docLit $ Text.pack "(", docLit $ Text.pack ")")
|
||||||
|
@ -385,8 +385,6 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
end = closeLit
|
end = closeLit
|
||||||
in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
|
in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
|
||||||
]
|
]
|
||||||
ExplicitTuple{} ->
|
|
||||||
unknownNodeError "ExplicitTuple|.." lexpr
|
|
||||||
HsCase cExp (MG lmatches@(L _ matches) _ _ _) -> do
|
HsCase cExp (MG lmatches@(L _ matches) _ _ _) -> do
|
||||||
cExpDoc <- docSharedWrapper layoutExpr cExp
|
cExpDoc <- docSharedWrapper layoutExpr cExp
|
||||||
binderDoc <- docLit $ Text.pack "->"
|
binderDoc <- docLit $ Text.pack "->"
|
||||||
|
|
Loading…
Reference in New Issue