summaryrefslogtreecommitdiff
path: root/src/Parser
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-05-07 10:33:36 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-07-13 17:37:09 +0200
commit92c763ad490accaec833ccf7a4775a5a3d4d078a (patch)
treec3640fcdd56a8432c20b82200d808f343ac5cf28 /src/Parser
parentc07f047bc90b6052b7d61de8efcbd7cb9d763e46 (diff)
Show record selectors in failure reports
Changelog: Show record selectors in failure reports
Diffstat (limited to 'src/Parser')
-rw-r--r--src/Parser/Expr.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Parser/Expr.hs b/src/Parser/Expr.hs
index eefc5cc..70649b2 100644
--- a/src/Parser/Expr.hs
+++ b/src/Parser/Expr.hs
@@ -289,10 +289,10 @@ someExpr = join inner <?> "expression"
SomeExpr e <- p
let err = parseError $ FancyError off $ S.singleton $ ErrorFail $ T.unpack $ T.concat
[ T.pack "value of type ", textExprType e, T.pack " does not have member '", m, T.pack "'" ]
- maybe err return $ applyRecordSelector e <$> lookup m recordMembers
+ maybe err return $ applyRecordSelector m e <$> lookup m recordMembers
- applyRecordSelector :: ExprType a => Expr a -> RecordSelector a -> SomeExpr
- applyRecordSelector e (RecordSelector f) = SomeExpr $ f <$> e
+ applyRecordSelector :: ExprType a => Text -> Expr a -> RecordSelector a -> SomeExpr
+ applyRecordSelector m e (RecordSelector f) = SomeExpr $ App (AnnRecord m) (pure f) e
literal = label "literal" $ choice
[ return <$> numberLiteral