From 92c763ad490accaec833ccf7a4775a5a3d4d078a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Sun, 7 May 2023 10:33:36 +0200
Subject: Show record selectors in failure reports

Changelog: Show record selectors in failure reports
---
 src/Parser/Expr.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/Parser')

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
-- 
cgit v1.2.3