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

GHC 8.10.2 incompatibility with preprocessor plugin #35

Closed
Dessix opened this issue Oct 30, 2020 · 6 comments
Closed

GHC 8.10.2 incompatibility with preprocessor plugin #35

Dessix opened this issue Oct 30, 2020 · 6 comments

Comments

@Dessix
Copy link

Dessix commented Oct 30, 2020

The following line from the RIO quickstart fails on GHC 8.10.2 but builds just fine on 8.10.1.

data Options = Options { optionsVerbose :: Bool }

This seems to happen with all records; the failures 8.10.2 produces with the plugin enabled look like this:

    • Illegal instance declaration for
        ‘GHC.Records.Extra.HasField "optionsVerbose" Options aplg’
        The coverage condition fails in class ‘GHC.Records.Extra.HasField’
          for functional dependency: ‘x r -> a’
        Reason: lhs types ‘"optionsVerbose"’, ‘Options’
          do not jointly determine rhs type ‘aplg’
        Un-determined variable: aplg
        Using UndecidableInstances might help
    • In the instance declaration for
        ‘GHC.Records.Extra.HasField "optionsVerbose" Options aplg’
@ndmitchell
Copy link
Owner

Are you using the same version of record-dot-preprocessor in both versions of GHC? The latest version requires the extensions listed at https://github.com/ndmitchell/record-dot-preprocessor#how-do-i-use-this-magic, which includes turning on UndecidableInstances. My suspicion is you are using the older version with the older GHC.

@Dessix
Copy link
Author

Dessix commented Oct 30, 2020

Ah- that’d do it. What changed to make undecidables necessary? Unless I’m mistaken, they’re a bit iffy to enable at all, let alone across the entire codebase?

@ndmitchell
Copy link
Owner

Records containing type families - see #29 - require undecidable instances. They can be iffy in places, and I wouldn't want them to be a long-term solution, but the whole record-dot-preprocessor thing is meant to be a stopgap to real compiler support. It would be possible to have two plugin modules, one with undecidable and one without, if it mattered enough to people.

@Dessix
Copy link
Author

Dessix commented Oct 30, 2020

Was this type families constraint introduced in 8.10.2? My types didn’t change, as far as I’m aware, and I don’t think a boolean is a type family?

@ndmitchell
Copy link
Owner

It was introduced in record-dot-preprocessor 0.2.7. I imagine you have 0.2.6 installed on GHC 8.10.1.

It isn't a type family, but we moved to a desugaring that allows type families (before they would fail), but unfortunately requires that extension.

@neongreen
Copy link

This change was done in #34.

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

No branches or pull requests

3 participants