Skip to content
Snippets Groups Projects
Commit 5a109223 authored by Rodrigo Mesquita's avatar Rodrigo Mesquita :seedling: Committed by Mergify
Browse files

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 db683f26)
parent a633f260
Branches mergify/bp/3.12/pr-10404
No related tags found
No related merge requests found
......@@ -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
......@@ -276,7 +276,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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment