[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

#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