Support RecursiveDo/`rec` keyword
parent
338beb8eea
commit
26f8cdfb65
|
@ -48,3 +48,21 @@ func
|
|||
)
|
||||
-> ()
|
||||
|
||||
|
||||
###############################################################################
|
||||
## RecursiveDo
|
||||
#test recursivedo 1
|
||||
{-# LANGUAGE RecursiveDo #-}
|
||||
foo = do
|
||||
rec a <- f b
|
||||
b <- g a
|
||||
return (a, b)
|
||||
|
||||
#test recursivedo 2
|
||||
{-# LANGUAGE RecursiveDo #-}
|
||||
foo = do
|
||||
rec -- comment
|
||||
a <- f b
|
||||
b <- g a
|
||||
return (a, b)
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@ layoutStmt lstmt@(L _ stmt) = docWrapNode lstmt $ case stmt of
|
|||
(docLit $ Text.pack "let")
|
||||
(docSetBaseAndIndent $ docLines $ return <$> bindDocs)
|
||||
]
|
||||
RecStmt stmts _ _ _ _ _ _ _ _ _ -> do
|
||||
docSeq
|
||||
[ docLit (Text.pack "rec")
|
||||
, docSeparator
|
||||
, docSetBaseAndIndent $ docLines $ layoutStmt <$> stmts
|
||||
]
|
||||
BodyStmt expr _ _ _ -> do
|
||||
expDoc <- docSharedWrapper layoutExpr expr
|
||||
docAddBaseY BrIndentRegular $ expDoc
|
||||
|
|
Loading…
Reference in New Issue