[GHC] #10604: Make Generic1 kind polymorphic

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: | Owner: ekmett DerekElkins | Status: new Type: feature | Milestone: request | Version: 7.10.1 Priority: low | Operating System: Unknown/Multiple Component: Core | Type of failure: None/Unknown Libraries | Blocked By: Keywords: | Related Tickets: Architecture: | Unknown/Multiple | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- It looks to me that the Generic1 class (and the Rep1 associated type) can immediately be generalized to forall k. k -> *. If k was instantiated to anything other than *, you wouldn't be able to make an instance for Par1, but then I don't think it would ever come up so that would be exactly the right behavior. This allows, in particular, DataKinds to be used as a parameter to instances of Generic1. I don't know if this would affect deriving, but I wouldn't really expect it to. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: ekmett Type: feature request | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Old description:
It looks to me that the Generic1 class (and the Rep1 associated type) can immediately be generalized to forall k. k -> *. If k was instantiated to anything other than *, you wouldn't be able to make an instance for Par1, but then I don't think it would ever come up so that would be exactly the right behavior. This allows, in particular, DataKinds to be used as a parameter to instances of Generic1.
I don't know if this would affect deriving, but I wouldn't really expect it to.
New description: It looks to me that the `Generic1` class (and the `Rep1` associated type) can immediately be generalized to `forall k. k -> *`. If `k` was instantiated to anything other than `*`, you wouldn't be able to make an instance for `Par1`, but then I don't think it would ever come up so that would be exactly the right behavior. This allows, in particular, `DataKinds` to be used as a parameter to instances of `Generic1`. I don't know if this would affect deriving, but I wouldn't really expect it to. -- Comment (by simonpj): Happily, Andres Loh has agreed to take a lead in `Generics` and `DeriveAnyClass`, but only later this summer. Thanks Andres! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: ekmett Type: feature request | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by dreixel): Do you have any particular use for this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: ekmett Type: feature request | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by DerekElkins): Replying to [comment:2 dreixel]:
Do you have any particular use for this?
I was making a data type parameterized by a data kind because it was built over another data type parameterized by a data kind. This blocked being able to use GHC Generics with the type. In this case, since I controlled the other data type, I just switched it to using empty data types of kind * rather than a data kind, so I'm not blocked by this. If that other data type had been from a library or if data kinds were critical, this wouldn't have been an option. The Tree type here https://github.com/derekelkins/ads/blob/master/Data/Authenticated/GenericExa... was where I ran into the problem when the Auth type was parameterized by a data kind. You can see here, https://github.com/derekelkins/ads/blob/master/Data/Authenticated/Generic.hs, that the Par1 constructor doesn't make sense in my context. In fact, with DataKinds I would not need that comment, because it would simply be illegal to make a type that used Par1. It would be a self-evident kind error rather than a less obvious missing instance error. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: ekmett Type: feature request | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ekmett): I have a number of data types for things like McBride-style indexed monads for which I currently can't use Generic support because of this issue. This consequently requires me to laboriously hand-implement support for things like serialization. It seems relatively painless to implement. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: RyanGlScott, ekmett (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => Generics -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: RyanGlScott Type: feature request | Status: patch Priority: low | Milestone: 8.2.1 Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: 11837 | Blocking: Related Tickets: | Differential Rev(s): Phab:D2168 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D2168 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10604: Make Generic1 kind polymorphic
-------------------------------------+-------------------------------------
Reporter: DerekElkins | Owner: RyanGlScott
Type: feature request | Status: patch
Priority: low | Milestone: 8.2.1
Component: Core Libraries | Version: 7.10.1
Resolution: | Keywords: Generics
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2168
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10604: Make Generic1 kind polymorphic -------------------------------------+------------------------------------- Reporter: DerekElkins | Owner: RyanGlScott Type: feature request | Status: closed Priority: low | Milestone: 8.2.1 Component: Core Libraries | Version: 7.10.1 Resolution: fixed | Keywords: Generics Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | generics/T10604/T10604_* Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2168 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: patch => closed * testcase: => generics/T10604/T10604_* * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10604#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC