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

Adapt to changes in TypeRep complete patterns #186

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

sheaf
Copy link
Contributor

@sheaf sheaf commented Aug 13, 2021

GHC merge request !963 improved the behaviour of the pattern match checker in the presence of COMPLETE annotations. This allows the removal of the Fun pattern from the complete sets Con, App and Con', App in Data.Typeable.Internal, which I expect to be done in GHC 9.4 (so base 4.17).

As a result, we get a pattern match warning in Data.Binary.Class.putTypeRep, which this patch addresses.

To be clear, the pattern was already redundant, it's just that GHC didn't see it because of how the COMPLETE pragmas used to be set up; calling putTypeRep (Fun arg res) already went through through the App branch:

import Data.Binary ( encode )
import Data.ByteString.Lazy ( unpack )
import Type.Reflection ( pattern Fun, typeRep )

> head . unpack . encode $ Fun (typeRep @Int) (typeRep @Int)
2

Which indicates the App branch, and not the Fun branch (which uses the tag 3).

@sheaf sheaf force-pushed the wip/typerep-changes branch 3 times, most recently from 5052209 to d0e9641 Compare August 18, 2021 10:36
GHC merge request !963 improved warnings in the presence of
COMPLETE annotations. This allows the removal of the Fun pattern
from the complete set.

This patch accounts for the resulting changes in pattern match warnings.
@sheaf
Copy link
Contributor Author

sheaf commented Aug 18, 2021

I believe this is ready to be merged. Companion GHC MR: !6372.

@bgamari bgamari merged commit 6af054b into kolmodin:master Mar 30, 2022
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.

None yet

2 participants