[GHC] #11400: * is not an indexed type family

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 (Type checker) | Keywords: TypeInType | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I can't seem to create an indexed data family using the kind `*` with `-XTypeInType` enabled. I have to work around it by using `Type`: {{{ $ /opt/ghc/head/bin/ghci GHCi, version 8.1.20160108: http://www.haskell.org/ghc/ :? for help λ> :set -XTypeInType -XTypeFamilies λ> import Data.Kind λ> data family IdxProxy k (a :: k) λ> data instance IdxProxy * a <interactive>:5:1: error: • Illegal family instance for ‘*’ (* is not an indexed type family) • In the data instance declaration for ‘*’ λ> data instance IdxProxy Type a λ> :kind! IdxProxy * IdxProxy * :: * -> * = IdxProxy * λ> :kind! IdxProxy Type IdxProxy Type :: Type -> * = IdxProxy Type }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Actually, this might just be a parser issue, not a data family issue. I can also get the above instance to work by typing it in as {{{#!hs data instance IdxProxy (*) a }}} Which leads me to believe that GHC is parsing {{{data instance IdxProxy * a}}} as {{{data instance (*) IdProxy a}}}—that is, it's interpreting `*` as an infix type operator (as evidence, typing in the latter declaration gets the same error message the former). I'm not sure how tricky it would be to detangle the parser in this case, since I'm not sure how GHC knows to choose `Data.Kind.*` over an infix type operator that happens to be named `*`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jstolarek): I've run into the same problem. I think this is a ''wontfix''. Richard promised to document the need for parens in the User's Guide, but I don't think he did that yet. Is this the relevant section: http://downloads.haskell.org/~ghc/master/users-guide//glasgow_exts.html #promoting-type-operators ? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Indeed, having a complete rundown of where you need to parenthesize `*` would be extremely helpful. (I think you also need to parenthesize it when reexporting it, i.e., `type (*)`, correct?) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Also doesn't `TypeInType` use "`Type`" in place of "`*`"? I'm a bit confused. Richard? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jstolarek): I believe `Type` and `*` are synonyms. So theoretically they can be used interchangeably but practically there is this special case for parsing when `*` needs to be parenthesized. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): This whole thing is very much a design compromise. It would be fully backward compatible simply to disallow `*` in `TypeInType` code, in favor of `Type`. Of course it's backward compatible, as `TypeInType` is new. But it has a terrible migration story, because you can't use `Type` for `*` in GHC 7.x. So I did a bit of parser hackery to get this to hold together. But it really only works when parsing a normal type. Other places where types appear in unusual situations don't work out so well. (For example, type instance heads and Haskell98 data constructors.) Could this be fixed? I'm sure it could, but it's quite painful each time. I'm quite happy to change designs around this issue. Or for someone to do more parser hackery to get `*` to work in more contexts. This ticket has the same fix as #11307, which is to have new abstract syntax for type instance heads. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Fair enough. But is the compromise documented in the user manual? Maybe so -- but if not, doing to would be very worth while. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: 11307 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * blockedby: => 11307 Comment: Will clarify when I write the `TypeInType` documentation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.1
checker) | Keywords: TypeInType,
Resolution: | TypeFamilies
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: 11307 | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Keywords: TypeInType, Resolution: | TypeFamilies Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: 11307 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => merge Comment: May as well merge the documentation update. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11400: * is not an indexed type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.2 Component: Compiler (Type | Version: 8.1 checker) | Keywords: TypeInType, Resolution: fixed | TypeFamilies Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: 11307 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed * milestone: => 8.2.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11400#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC