From b731cd15e7e69fb3d793af906d9c05ca76c3879a Mon Sep 17 00:00:00 2001
From: Matthew Piziak <matthew.piziak@symbiont.io>
Date: Thu, 14 Dec 2017 16:17:39 -0500
Subject: [PATCH 1/2] capture starting layout

---
 src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs b/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs
index 0ed8a31..2eb1863 100644
--- a/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs
+++ b/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs
@@ -341,9 +341,9 @@ layoutExpr lexpr@(L _ expr) = do
       opDoc    <- docSharedWrapper layoutExpr op
       rightDoc <- docSharedWrapper layoutExpr right
       docSeq [opDoc, docSeparator, rightDoc]
-    ExplicitTuple args boxity
-      | Just argExprs <- args `forM` (\case (L _ (Present e)) -> Just e; _ -> Nothing) -> do
-      argDocs <- docSharedWrapper layoutExpr `mapM` argExprs
+    ExplicitTuple args boxity -> do
+      let argExprs = fmap (\case (L _ (Present e)) -> Just e; (L _ (Missing PlaceHolder)) -> Nothing) args
+      argDocs <- docSharedWrapper (maybe docEmpty layoutExpr) `mapM` argExprs
       hasComments <- hasAnyCommentsBelow lexpr
       let (openLit, closeLit) = case boxity of
             Boxed -> (docLit $ Text.pack "(", docLit $ Text.pack ")")
@@ -385,8 +385,6 @@ layoutExpr lexpr@(L _ expr) = do
                 end   = closeLit
               in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
             ]
-    ExplicitTuple{} ->
-      unknownNodeError "ExplicitTuple|.." lexpr 
     HsCase cExp (MG lmatches@(L _ matches) _ _ _) -> do
       cExpDoc <- docSharedWrapper layoutExpr cExp
       binderDoc <- docLit $ Text.pack "->"

From 9704fc34908bba3a6e6c4e1ccd04ca0382b19e92 Mon Sep 17 00:00:00 2001
From: Matthew Piziak <matthew.piziak@symbiont.io>
Date: Thu, 14 Dec 2017 18:15:07 -0500
Subject: [PATCH 2/2] add tuple section tests

---
 src-literatetests/10-tests.blt | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src-literatetests/10-tests.blt b/src-literatetests/10-tests.blt
index c6d4203..a3d8591 100644
--- a/src-literatetests/10-tests.blt
+++ b/src-literatetests/10-tests.blt
@@ -476,9 +476,23 @@ func = (`abc` 1)
 #group tuples
 ###
 
-#test 1
+#test pair
 func = (abc, def)
 
+#test pair section left
+func = (abc, )
+
+#test pair section right
+func = (, abc)
+
+#test quintuple section long
+myTupleSection =
+  ( verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargefirstelement
+  ,
+  , verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargethirdelement
+  ,
+  )
+
 #test 2
 #pending
 func = (lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd