From 6c3d9c57c5fc730673b932b11287412d1cf9fef7 Mon Sep 17 00:00:00 2001
From: Lennart Spitzner <hexagoxel@hexagoxel.de>
Date: Wed, 27 Nov 2019 21:19:10 +0100
Subject: [PATCH] Comment the single-line record decl config flag out

---
 src-literatetests/10-tests.blt                   |  1 +
 src-literatetests/Main.hs                        |  2 +-
 src-unittests/TestUtils.hs                       |  2 +-
 src/Language/Haskell/Brittany/Internal/Config.hs |  4 ++--
 .../Haskell/Brittany/Internal/Config/Types.hs    | 16 ++++++++--------
 .../Brittany/Internal/Layouters/DataDecl.hs      |  3 ++-
 6 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src-literatetests/10-tests.blt b/src-literatetests/10-tests.blt
index 2e46148..7dc1e45 100644
--- a/src-literatetests/10-tests.blt
+++ b/src-literatetests/10-tests.blt
@@ -378,6 +378,7 @@ data
     }
 
 #test record single line layout
+#pending config flag is disabled for now
 {-# LANGUAGE ScopedTypeVariables #-}
 -- brittany { lconfig_allowSinglelineRecord: true }
 data MyRecord = forall a . Show a => MyCons { foo :: a -> a, i :: Int }
diff --git a/src-literatetests/Main.hs b/src-literatetests/Main.hs
index d0b9094..3595b1f 100644
--- a/src-literatetests/Main.hs
+++ b/src-literatetests/Main.hs
@@ -214,7 +214,7 @@ defaultTestConfig = Config
     , _lconfig_allowSingleLineExportList = coerce True
     , _lconfig_allowHangingQuasiQuotes   = coerce True
     , _lconfig_experimentalSemicolonNewlines = coerce False
-    , _lconfig_allowSinglelineRecord     = coerce False
+    -- , _lconfig_allowSinglelineRecord     = coerce False
     }
   , _conf_errorHandling             = (_conf_errorHandling staticDefaultConfig) { _econf_omit_output_valid_check = coerce True }
   , _conf_preprocessor              = _conf_preprocessor staticDefaultConfig
diff --git a/src-unittests/TestUtils.hs b/src-unittests/TestUtils.hs
index f2dc542..3f24266 100644
--- a/src-unittests/TestUtils.hs
+++ b/src-unittests/TestUtils.hs
@@ -61,7 +61,7 @@ defaultTestConfig = Config
     , _lconfig_allowSingleLineExportList = coerce True
     , _lconfig_allowHangingQuasiQuotes   = coerce True
     , _lconfig_experimentalSemicolonNewlines = coerce False
-    , _lconfig_allowSinglelineRecord     = coerce False
+    -- , _lconfig_allowSinglelineRecord     = coerce False
     }
   , _conf_errorHandling             = (_conf_errorHandling staticDefaultConfig)
     { _econf_ExactPrintFallback = coerce ExactPrintFallbackModeNever
diff --git a/src/Language/Haskell/Brittany/Internal/Config.hs b/src/Language/Haskell/Brittany/Internal/Config.hs
index 9dac6b7..a5bbdbd 100644
--- a/src/Language/Haskell/Brittany/Internal/Config.hs
+++ b/src/Language/Haskell/Brittany/Internal/Config.hs
@@ -77,7 +77,7 @@ staticDefaultConfig = Config
     , _lconfig_allowSingleLineExportList = coerce False
     , _lconfig_allowHangingQuasiQuotes   = coerce True
     , _lconfig_experimentalSemicolonNewlines = coerce False
-    , _lconfig_allowSinglelineRecord     = coerce False
+    -- , _lconfig_allowSinglelineRecord     = coerce False
     }
   , _conf_errorHandling = ErrorHandlingConfig
     { _econf_produceOutputOnErrors   = coerce False
@@ -182,7 +182,7 @@ cmdlineConfigParser = do
       , _lconfig_allowSingleLineExportList = mempty
       , _lconfig_allowHangingQuasiQuotes   = mempty
       , _lconfig_experimentalSemicolonNewlines = mempty
-      , _lconfig_allowSinglelineRecord     = mempty
+      -- , _lconfig_allowSinglelineRecord     = mempty
       }
     , _conf_errorHandling = ErrorHandlingConfig
       { _econf_produceOutputOnErrors   = wrapLast $ falseToNothing outputOnErrors
diff --git a/src/Language/Haskell/Brittany/Internal/Config/Types.hs b/src/Language/Haskell/Brittany/Internal/Config/Types.hs
index 526afef..a244eae 100644
--- a/src/Language/Haskell/Brittany/Internal/Config/Types.hs
+++ b/src/Language/Haskell/Brittany/Internal/Config/Types.hs
@@ -142,14 +142,14 @@ data CLayoutConfig f = LayoutConfig
     -- The implementation for this is a bit hacky and not tested; it might
     -- break output syntax or not work properly for every kind of brace. So
     -- far I have considered `do` and `case-of`.
-  , _lconfig_allowSinglelineRecord :: f (Last Bool)
-    -- if true, layouts record data decls as a single line when possible, e.g.
-    -- > MyPoint { x :: Double, y :: Double }
-    -- if false, always use the multi-line layout
-    -- > MyPoint
-    -- >   { x :: Double
-    -- >   , y :: Double
-    -- >   }
+  -- , _lconfig_allowSinglelineRecord :: f (Last Bool)
+  --   -- if true, layouts record data decls as a single line when possible, e.g.
+  --   -- > MyPoint { x :: Double, y :: Double }
+  --   -- if false, always use the multi-line layout
+  --   -- > MyPoint
+  --   -- >   { x :: Double
+  --   -- >   , y :: Double
+  --   -- >   }
   }
   deriving (Generic)
 
diff --git a/src/Language/Haskell/Brittany/Internal/Layouters/DataDecl.hs b/src/Language/Haskell/Brittany/Internal/Layouters/DataDecl.hs
index e11acfa..fb4205d 100644
--- a/src/Language/Haskell/Brittany/Internal/Layouters/DataDecl.hs
+++ b/src/Language/Haskell/Brittany/Internal/Layouters/DataDecl.hs
@@ -403,7 +403,8 @@ createDetailsDoc consNameStr details = case details of
   RecCon (L _ []) -> docSeq [docLit consNameStr, docSeparator, docLit $ Text.pack "{}"]
   RecCon lRec@(L _ fields@(_:_)) -> do
     let ((fName1, fType1) : fDocR) = mkFieldDocs fields
-    allowSingleline <- mAsk <&> _conf_layout .> _lconfig_allowSinglelineRecord .> confUnpack
+    -- allowSingleline <- mAsk <&> _conf_layout .> _lconfig_allowSinglelineRecord .> confUnpack
+    let allowSingleline = False
     docAddBaseY BrIndentRegular
       $ docSetIndentLevel
       $ runFilteredAlternative