Fix layouting issues in lists/listcomprehension

pull/35/head
Lennart Spitzner 2017-05-17 22:52:24 +02:00
parent 56e53a9cbb
commit 83ba7803e6
2 changed files with 38 additions and 2 deletions

View File

@ -500,6 +500,24 @@ func = do
stmt x stmt x
###############################################################################
###############################################################################
###############################################################################
#group expression.lists
###############################################################################
###############################################################################
###############################################################################
#test monad-comprehension-case-of
func =
foooooo
$ [ case
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
of
_ -> True
]
############################################################################### ###############################################################################
############################################################################### ###############################################################################
############################################################################### ###############################################################################
@ -786,6 +804,22 @@ func (MyLongFoo abc def) = 1
func (Bar a d ) = 2 func (Bar a d ) = 2
func _ = 3 func _ = 3
#test listcomprehension-case-of
parserCompactLocation =
[ try
$ [ ParseRelAbs (Text.Read.read digits) _ _
| digits <- many1 digit
, rel1 :: Maybe (Either Int (Ratio Int)) <- optionMaybe
[ case divPart of
Nothing -> Left $ Text.Read.read digits
Just ddigits ->
Right $ Text.Read.read digits % Text.Read.read ddigits
| digits <- many1 digit
, divPart <- optionMaybe (string "/" *> many1 digit)
]
]
]
############################################################################### ###############################################################################
############################################################################### ###############################################################################

View File

@ -559,7 +559,8 @@ layoutExpr lexpr@(L _ expr) = docWrapNode lexpr $ case expr of
start = docCols ColListComp start = docCols ColListComp
[ docNodeAnnKW lexpr Nothing [ docNodeAnnKW lexpr Nothing
$ appSep $ docLit $ Text.pack "[" $ appSep $ docLit $ Text.pack "["
, docNodeAnnKW lexpr (Just AnnOpenS) , docSetBaseY
$ docNodeAnnKW lexpr (Just AnnOpenS)
$ List.last stmtDocs $ List.last stmtDocs
] ]
(s1:sM) = List.init stmtDocs (s1:sM) = List.init stmtDocs
@ -590,7 +591,8 @@ layoutExpr lexpr@(L _ expr) = docWrapNode lexpr $ case expr of
, docSetBaseY $ docLines , docSetBaseY $ docLines
[ docSeq [ docSeq
[ docLit $ Text.pack "[" [ docLit $ Text.pack "["
, docNodeAnnKW lexpr (Just AnnOpenS) $ docForceSingleline e , docSeparator
, docSetBaseY $ docNodeAnnKW lexpr (Just AnnOpenS) $ e
] ]
, docLit $ Text.pack "]" , docLit $ Text.pack "]"
] ]