[GHC] #14131: Difference between newtype and newtype instance
GHC
ghc-devs at haskell.org
Mon Aug 21 14:03:10 UTC 2017
#14131: Difference between newtype and newtype instance
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: RyanGlScott
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: TypeFamilies
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #7938, #9574, | Differential Rev(s): Phab:D3872
#13985 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Replying to [comment:13 simonpj]:
> Really? `reportFloatingKvs` seems to report variables mentioned in
`typat_tvs`, which doesn't look like the ones on the RHS. I wasn't
expecting a test in `tcFamTyPats`, but rather in `tcTyFamInstEqn`.
Ah, I think I managed to confuse you by naming that variable `typat_tvs`.
Those are the type variables that are used in type patterns (visible and
invisible) //or// the RHS (these are collected during renaming, see
`rnFamInstDecl`). We discover in `tcFamTyPats` which variables are
actually bound by type patterns, so if there are any used variables that
aren't bound, then they're free-floating (and summarily rejected).
I suppose I should rename `typat_tvs` to something like `fam_used_tvs` to
avoid this confusion.
> DO you have a test like the example in comment:8?
Yes, see `testsuite/tests/polykinds/T13985.hs`. In the particular case of
type family instances, it tests this:
{{{#!hs
type instance T = Proxy (Nothing :: Maybe a)
}}}
Which is rejected for having a free-floating `a`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14131#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list