ref: 466bdea5e6fed40315643a604fadedf864522088
parent: 8354f3d9daea9503a7137a714f1920a664adc65e
author: Lennart Augustsson <lennart@augustsson.net>
date: Wed Dec 25 10:47:01 EST 2024
Better parsing of view patterns.
--- a/src/MicroHs/Parse.hs
+++ b/src/MicroHs/Parse.hs
@@ -544,7 +544,7 @@
<|< pLit
<|< (eTuple <$> (pSpec '(' *> esepBy pPat (pSpec ',') <* pSpec ')'))
<|< (EListish . LList <$> (pSpec '[' *> esepBy1 pPat (pSpec ',') <* pSpec ']'))
- <|< (EViewPat <$> (pSpec '(' *> pAExpr) <*> (pSRArrow *> pAPat <* pSpec ')'))
+ <|< (EViewPat <$> (pSpec '(' *> pAExpr) <*> (pSRArrow *> pPatApp <* pSpec ')'))
<|< (ELazy True <$> (pSpec '~' *> pAPat))
<|< (ELazy False <$> (pSpec '!' *> pAPat))
<|< (EOr <$> (pSpec '(' *> esepBy1 pPat (pSpec ';') <* pSpec ')')) -- if there is a single pattern it will be matched by the tuple case