Allow special layout for HsApp with HsDo/HsSpiceE args

ghc92
Lennart Spitzner 2023-04-29 10:08:01 +00:00
parent ab67a794db
commit 884c7da97c
3 changed files with 37 additions and 18 deletions

View File

@ -306,8 +306,7 @@ parserCompactLocation =
[ try
$ [ ParseRelAbs (Text.Read.read digits) _ _
| digits <- many1 digit
, rel1 :: Maybe (Either Int (Ratio Int)) <-
optionMaybe
, rel1 :: Maybe (Either Int (Ratio Int)) <- optionMaybe
[ case divPart of
Nothing -> Left $ Text.Read.read digits
Just ddigits ->
@ -938,3 +937,22 @@ tzejubuVxairoy
-- foo bar
=> CUR.Ozuzcak zub
-> m ()
#test allow par-spacing for HsApp HsDo
func = other $ meep
do
abc
def
(some other very long linnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnne)
#test allow par-spacing for HsApp HsDo
func = other $ meep
[ x | x <- myList ]
(some other very long linnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnne)
#test allow par-spacing for HsApp HsSpliceE
{-# LANGUAGE QuasiQuotes #-}
func = other $ meep
[q|hello
world|]
(some other very long linnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnne)

View File

@ -1252,8 +1252,7 @@ parserCompactLocation =
[ try
$ [ ParseRelAbs (Text.Read.read digits) _ _
| digits <- many1 digit
, rel1 :: Maybe (Either Int (Ratio Int)) <-
optionMaybe
, rel1 :: Maybe (Either Int (Ratio Int)) <- optionMaybe
[ case divPart of
Nothing -> Left $ Text.Read.read digits
Just ddigits ->

View File

@ -194,6 +194,8 @@ layoutExpr lexpr@(L _ expr) = do
(_, L _ ExplicitTuple{}) -> True
(_, L _ ExplicitList{}) -> True
(_, L _ HsPar{}) -> True
(_, L _ HsDo{}) -> True
(_, L _ HsSpliceE{}) -> True
_ -> False
let wrap = if all checkAllowPar paramEs then docSetParSpacing else id
wrap $ docAddBaseY BrIndentRegular $ docPar