Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MFP compat: s/fail/error/ in compileStmt #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deepfire
Copy link
Contributor

@deepfire deepfire commented Jul 1, 2019

This gets rid of one of the issues on GHC 8.8.

@@ -112,12 +112,12 @@ compileStmt lhs compilegt ds = \case
alts -> compileStmt lhs compileGuardTrees' [TypeAnn n t] alts
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not this change the semantics?
The error is more lazy than fail AFAIK.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants