[GHC] #10586: GHC 7.10.1 panic due to wildcard in data family instance
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: | Owner: WrenThornton | Status: new Type: bug | Milestone: Priority: normal | Version: 7.10.1 Component: Compiler | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- The following simple program causes GHC 7.10.1 (for x86_64-apple-darwin) to panic (rnHsTyKi HsWildcardTy): {{{#!hs {-# LANGUAGE TypeFamilies, GADTs, DataKinds, PolyKinds #-} data MyKind = A | B data family Sing (a :: k) data instance Sing (_ :: MyKind) where SingA :: Sing A SingB :: Sing B }}} Because data family instances must be fully saturated, we must give some name to the parameter; but because our instance is a GADT, the name of that parameter is meaningless, so using the wildcard makes complete sense here. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #3699 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by goldfire): * related: => #3699 Comment: Allowing underscores there would be nice. See ticket #3699. But we surely shouldn't panic here. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #3699 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by WrenThornton): Yeah, even if they aren't supported (yet), we shouldn't panic! :) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomasw): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomasw): This is fixed in HEAD by Phab:D613. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): Is it committed, or simply in Phab? Is there a regression test? If so can you update the "Test case" field? If not can you add one? Thanks -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomasw): Replying to [comment:5 simonpj]:
Is it committed, or simply in Phab? Is there a regression test? If so can you update the "Test case" field? If not can you add one? Thanks
[https://git.haskell.org/ghc.git/commit/058af6c90a0e8d122f2d1339b6b4fd0b5ec83... Yes]. I have a test for a wild card in a type instance, I'll add one for this too then. I'm actually thinking about adding support for wild cards in data/type instances. I would just replace them with fresh meta variables. This would also address #3699. I don't think named wild cards or extra-constraints wild cards make sense here. What do you think? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj):
I'm actually thinking about adding support for wild cards in data/type instances. I would just replace them with fresh meta variables. This would also address #3699. I don't think named wild cards or extra-constraints wild cards make sense here. What do you think?
Yes, I agree. Do not use a ''meta'' variable. These are really ''skolems'', just like the named type variables in an ordinary declaration, just anonymous ones. Would need documentation about exactly where these skolem wildcards can appear. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomasw): Replying to [comment:7 simonpj]:
I'm actually thinking about adding support for wild cards in data/type instances. I would just replace them with fresh meta variables. This would also address #3699. I don't think named wild cards or extra-constraints wild cards make sense here. What do you think?
Yes, I agree. Do not use a ''meta'' variable. These are really ''skolems'', just like the named type variables in an ordinary declaration, just anonymous ones.
Given the freshly generated `Name` of an anonymous wild card, which function should I use to create a skolem? `newSigTyVar :: Name -> Kind -> TcM TcTyVar` in TcMType using `newMetaKindVar :: TcM TcKind` as kind? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): Follow the pattern in `TcHsType.tcHsTyVarBndr` (which in any case is probably the function you'll need to modify). It uses `mkTcTyVar` as far as I can see. Just do the same, but with a fresh `Name`. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | 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: #3699 | Differential Revisions: Phab:D1092 -------------------------------------+------------------------------------- Changes (by thomasw): * status: closed => new * differential: => Phab:D1092 * resolution: fixed => -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: thomasw Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | 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: #3699 | Differential Revisions: Phab:D1092 -------------------------------------+------------------------------------- Changes (by thomasw): * owner: => thomasw -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: thomasw Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | 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: #3699 | Differential Revisions: Phab:D1092 -------------------------------------+------------------------------------- Comment (by thomasw): See Phab:D1092 for a patch adding support for wild cards in type/data family instance declarations. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: thomasw Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | 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: #3699 | Differential Revisions: Phab:D1092 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"d9d2102ea7f6da1bc3a69fa469b89ea843cb8b02/ghc" d9d2102e/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="d9d2102ea7f6da1bc3a69fa469b89ea843cb8b02" Support wild cards in data/type family instances Handle anonymous wild cards in type or data family instance declarations like unnamed type variables. For instance (pun intented): type family F (a :: *) (b :: *) :: * type instance F Int _ = Int Is now the same as: type family F (a :: *) (b :: *) :: * type instance F Int x = Int Note that unlike wild cards in partial type signatures, no errors (or warnings with -XPartialTypeSignatures) are generated for these wild cards, as there is nothing interesting to report to the user, i.e. the inferred kind. Only anonymous wild cards are supported here, named and extra-constraints wild card are not. Test Plan: pass new tests Reviewers: goldfire, austin, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D1092 GHC Trac Issues: #3699, #10586 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:13> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10586: GHC 7.10.1 panic due to wildcard in data family instance -------------------------------------+------------------------------------- Reporter: WrenThornton | Owner: thomasw Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3699 | Differential Revisions: Phab:D1092 -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10586#comment:14> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC