Skip to content

Conversation

deepfire
Copy link
Contributor

@deepfire deepfire commented Jul 1, 2019

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

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