From db683f26affc22ee6b41fd8209734533a015ebe2 Mon Sep 17 00:00:00 2001 From: Rodrigo Mesquita 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. --- 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 8849fc13b10..4927ec1e69b 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 83ae28995a8..ec8463bd6d3 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)