support typechecking of type literals in backpack fixes #15138

Authored by ppk on Tue, Jul 10, 8:24 AM.


Trac Issues

Backpack is unable to type check signatures that expect a data which
is a type level literal. This was reported in issue Trac #15138. These
commits are a fix for this. It also includes a minimal test case that
was mentioned in the issue.

ppk created this revision.Tue, Jul 10, 8:24 AM
ppk added a comment.Thu, Jul 12, 3:35 AM

I noticed that there are some new line ugliness. Will add a commit for that.

ppk updated this revision to Diff 17278.Thu, Jul 12, 3:39 AM
  • some newline cleanups.
bgamari accepted this revision.Thu, Jul 12, 10:06 AM

Looks reasonable to me. Thanks!

This revision is now accepted and ready to land.Thu, Jul 12, 10:06 AM
ppk added a comment.Thu, Jul 12, 10:34 PM

Do you want me to do a commit sqashing. I think I can give better commit messages ?

ppk added a comment.Thu, Jul 12, 10:41 PM

There is one clarification that I still need so may be you can just hold on before you merge. The function in question seems to be used both for hs-boot files and hsig files. The very next guard in the function check whether the function is for hsig and there is a comment there saying that it does not work with hsboot. Since I do not understand the code fully, can you confirm whether I should add such a check for this clause also

ppk added a subscriber: ezyang.Sat, Jul 14, 11:14 AM

@ezyang I managed to fix this issue of Nats and Backpack. Can you have a look as there is somethings regarding hs-boot and hsig files here that are not clear to me.

ezyang accepted this revision.Sat, Jul 14, 4:14 PM

Two nits:

  1. Shouldn't be enabled for hs-boot files (it's probably harmless, but we'd have to reason about it carefully first)
  2. Use a function like this in Type.hs

But I'd be happy to take this in for 8.6 without the nits.

ppk added a comment.Sat, Jul 14, 5:03 PM

@ezyang Okey I will make the changes you suggested in a couple of days.

ppk updated this revision to Diff 17337.Mon, Jul 16, 1:08 AM
  • allow type literal for data declaration spec only in hsig files.
  • added the test isLitTy to the Types module
  • simplify typecheck with isLitTy.
ppk updated this revision to Diff 17338.Mon, Jul 16, 1:11 AM
  • typo in description of isLitTy.
ppk added a comment.Mon, Jul 16, 11:10 AM

The windows build failed due to some strange problems. Shall I restart the build ?

bgamari added a comment.EditedMon, Jul 16, 6:57 PM

Hmm, that is indeed quite peculiar. I've restarted it.

ppk added a comment.Tue, Jul 17, 10:50 PM

I guess this is finally ready to merge. If there is anything pending please let me know @bgamari @ezyang.