ref: dfcac072f30d0bd2936aa72f15d63d7690026cff
parent: 464fcccc8e5238d28d64879bc2ea6dec377ed7f6
author: Lennart Augustsson <lennart@augustsson.net>
date: Mon Sep 30 07:28:33 EDT 2024
Cannot have empty do
--- a/src/MicroHs/Parse.hs
+++ b/src/MicroHs/Parse.hs
@@ -644,7 +644,11 @@
pLet = ELet <$> (pKeyword "let" *> pBlock pBind) <*> (pKeyword "in" *> pExpr)
pDo :: P Expr
-pDo = EDo <$> ((Just <$> pQualDo) <|< (Nothing <$ pKeyword "do")) <*> pBlock pStmt
+pDo = do
+ q <- (Just <$> pQualDo) <|< (Nothing <$ pKeyword "do")
+ ss <- pBlock pStmt
+ guard (not (null ss))
+ pure (EDo q ss)
pIf :: P Expr
pIf = EIf <$> (pKeyword "if" *> pExpr) <*>
--
⑨