MFP compat: s/fail/error/ in compileStmt - #19
Open
deepfire wants to merge 1 commit into
Open
Conversation
csabahruska
reviewed
Jul 3, 2019
| fs@(FunAlt n vs _: _) -> case groupBy ((==) `on` fst) [(length vs, n) | FunAlt n vs _ <- fs] of | ||
| [gs@((num, _): _)] | ||
| | num == 0 && length gs > 1 -> fail $ "redefined " ++ sName n ++ ":\n" ++ show (vcat $ pShow . sourceInfo . snd <$> gs) | ||
| | num == 0 && length gs > 1 -> error $ "redefined " ++ sName n ++ ":\n" ++ show (vcat $ pShow . sourceInfo . snd <$> gs) |
Member
There was a problem hiding this comment.
Does not this change the semantics?
The error is more lazy than fail AFAIK.
There was a problem hiding this comment.
Disclaimer: I'm far from an expert in Haskell (I have a few hobby projects written in it)…
I think if I understood the MonadFail Proposal correctly, fail for Monads that didn't have a "reasonable" fail implementation and will not become MonadFail in the new proposal, was already implemented by calling error (which is part of why they are removing fail for those Monads).
If someone who actually is familiar with the internals of the MFP could confirm this, that would be good to know for sure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This gets rid of one of the issues on GHC 8.8.