Skip to content

Add message for GHC-72771 "Mismatched default method signature" #524

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

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

VeryMilkyJoe
Copy link
Contributor

No description provided.

introduced: 9.8.1
---

This error means that there is a type class with some method `m` for which a [default signature](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/default_signatures.html) was defined, but that default signature does not match the type signature of `m`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's link a stable released documentation instead of GitLab:

Suggested change
This error means that there is a type class with some method `m` for which a [default signature](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/default_signatures.html) was defined, but that default signature does not match the type signature of `m`.
This error means that there is a type class with some method `m` for which a [default signature](https://downloads.haskell.org/ghc/9.12.1/docs/users_guide/exts/default_signatures.html) was defined, but that default signature does not match the type signature of `m`.

class Enum a where
enum :: [a]
default enum :: (Int ~ a) => a
enum = [1..]
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. If you rename it to module Lib where there would be no need to define main :: IO (), minimizing the example.

  2. Let's add {-# LANGUAGE TypeOperators #-}, otherwise recent GHCs throw a warning about ~.

  3. Could we please rename Enum -> Enumerate, enum -> enumerate? So that we do not clash with a usual class Enum from Prelude.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, that all sounds much better!
I made changes accordingly.

@Bodigrim Bodigrim force-pushed the enhance/ghc-72771 branch from 8624c5b to c06423e Compare March 13, 2025 23:32
@Bodigrim Bodigrim force-pushed the enhance/ghc-72771 branch from c06423e to c503cf9 Compare March 13, 2025 23:37
@Bodigrim Bodigrim merged commit 57a18be into haskellfoundation:main Mar 13, 2025
2 checks passed
@Bodigrim
Copy link
Collaborator

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants