From 3cdc0a22a22d753025b80175e81ee556f2ee62c5 Mon Sep 17 00:00:00 2001
From: Rodrigo Mesquita <rodrigo.m.mesquita@gmail.com>
Date: Tue, 1 Oct 2024 16:18:24 +0100
Subject: [PATCH] Prefer ErrorCall to ErrorCallWithLocation

This future proofs the code for CLC#285, which will remove
`ErrorCallWithLocation` to de-duplicate duplicate CallStacks.

ErrorCall is already a pattern synonym with the same meaning as it will
have in the future, so this change is backwards compatible too.

(cherry picked from commit db683f26affc22ee6b41fd8209734533a015ebe2)
---
 Cabal-syntax/src/Distribution/Compat/Binary.hs    | 2 +-
 Cabal-syntax/src/Distribution/Utils/Structured.hs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cabal-syntax/src/Distribution/Compat/Binary.hs b/Cabal-syntax/src/Distribution/Compat/Binary.hs
index 8849fc13b1..4927ec1e69 100644
--- a/Cabal-syntax/src/Distribution/Compat/Binary.hs
+++ b/Cabal-syntax/src/Distribution/Compat/Binary.hs
@@ -20,4 +20,4 @@ decodeOrFailIO :: Binary a => ByteString -> IO (Either String a)
 decodeOrFailIO bs =
   catch (evaluate (decode bs) >>= return . Right) handler
   where
-    handler (ErrorCallWithLocation str _) = return $ Left str
+    handler (ErrorCall str) = return $ Left str
diff --git a/Cabal-syntax/src/Distribution/Utils/Structured.hs b/Cabal-syntax/src/Distribution/Utils/Structured.hs
index 83ae28995a..ec8463bd6d 100644
--- a/Cabal-syntax/src/Distribution/Utils/Structured.hs
+++ b/Cabal-syntax/src/Distribution/Utils/Structured.hs
@@ -277,7 +277,7 @@ structuredDecodeOrFailIO :: (Binary.Binary a, Structured a) => LBS.ByteString ->
 structuredDecodeOrFailIO bs =
   catch (evaluate (structuredDecode bs) >>= return . Right) handler
   where
-    handler (ErrorCallWithLocation str _) = return $ Left str
+    handler (ErrorCall str) = return $ Left str
 
 -- | Lazily reconstruct a value previously written to a file.
 structuredDecodeFileOrFail :: (Binary.Binary a, Structured a) => FilePath -> IO (Either String a)
-- 
GitLab