[GHC] #15740: Type family with higher-rank result is too accepting

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Keywords: TypeFamilies, | Operating System: Unknown/Multiple TypeInType | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- GHC accepts this garbage: {{{ type family F2 :: forall k. k -> Type data SBool :: Bool -> Type data Nat data SNat :: Nat -> Type type instance F2 = SBool type instance F2 = SNat }}} The family `F2` should have an arity of 0, meaning that only one instance is possible -- and the RHS of that instance must have kind `forall k. k -> Type`. In other words, even accepting only one of the instances above is hogwash. This is from comment:15:ticket:11719, but you don't have to read that to understand this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: TypeFamilies, | TypeInType 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 RyanGlScott): * cc: RyanGlScott (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: TypeFamilies, | TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): As noted in comment:16:ticket:11719, this behavior is a regression from GHC 8.2, which rejects those instances. The first commit to demonstrate this behavior is 4239238306e911803bf61fdda3ad356fd0b42e05 (Fix #12369 by being more flexible with data insts). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.8.1 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: TypeFamilies, | TypeInType 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): * priority: normal => high * milestone: => 8.8.1 Comment: Let's make sure this is fixed in 8.8. Can't be too hard... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.8.1 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: TypeFamilies, | TypeInType 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): * priority: high => highest -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.8.1 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: TypeFamilies, | TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15793 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #15793 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.8.1 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: TypeFamilies, | TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15793 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Simon appears to have stumbled upon this separately, in his ongoing work captured in Phab:D5305. The fix appears to be a small change to `kcTyFamEqnRhs` to instantiate only invisible arguments that are within the arity of the tyfam; right now, it wrongly instantiates ''all'' invisible arguments. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15740: Type family with higher-rank result is too accepting
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: highest | Milestone: 8.8.1
Component: Compiler | Version: 8.6.1
Resolution: | Keywords: TypeFamilies,
| TypeInType
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #15793 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#15740: Type family with higher-rank result is too accepting -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.8.1 Component: Compiler | Version: 8.6.1 Resolution: fixed | Keywords: TypeFamilies, | TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: indexed- | types/should_fail/T15740, | should_compile/T15740a Blocked By: | Blocking: Related Tickets: #15793 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => indexed-types/should_fail/T15740, should_compile/T15740a * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15740#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC