remove do-block braces in arguments

This commit is contained in:
Alexander Esgen 2019-12-02 22:46:59 +01:00 committed by Mark Karpov
parent 46ede8aa35
commit 3b745c723e
3 changed files with 15 additions and 1 deletions

View File

@ -27,3 +27,8 @@ f8 = foo \x ->
y
f9 = foo do { bar } baz
f10 = foo
do a
do b
do c

View File

@ -23,3 +23,8 @@ f8 = foo \x ->
y
f9 = foo do { bar } baz
f10 = foo
do { a }
do { b }
do c

View File

@ -18,6 +18,7 @@ import Ctype (is_space)
import Data.Bool (bool)
import Data.Char (isPunctuation, isSymbol)
import Data.Data hiding (Infix, Prefix)
import Data.Functor ((<&>))
import Data.List (intersperse, sortOn)
import Data.List.NonEmpty ((<|), NonEmpty ((:|)))
import qualified Data.List.NonEmpty as NE
@ -565,7 +566,10 @@ p_hsExpr' s = \case
if isOneLineSpan spn
then inci
else id
useBraces $ do
ub <- getLayout <&> \case
SingleLine -> useBraces
MultiLine -> id
ub $ do
located func (p_hsExpr' s)
breakpoint
indent $ sep breakpoint (located' p_hsExpr) initp