[GHC] #8556: Invalid constructor names are accepted in data declarations

#8556: Invalid constructor names are accepted in data declarations ------------------------------------+------------------------------------- Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- Earlier today, someone was asking on #haskell why the constructor name {{{(^)}}} wouldn't work in GADT definitions. My response was that {{{(^)}}} isn't a constructor name, but much to my surprise, GHC accepts such names in a regular data declaration: {{{ data Foo = F | (^^^^) Int Int }}} This creates a {{{Foo}}} type and value constructor {{{F}}}, but no value constructor {{{(^^^^)}}}. However, in 7.6.3, if DataKinds are enabled, both constructors appear at the type level. In HEAD, the same definition is accepted, with only {{{F}}} existing at the value level, as before. But at the type level, both {{{F}}} and {{{(^^^^)}}} just generate errors that {{{Foo}}} is not a promotable type. At that point, I think there's no question that the declaration should just be ruled out. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8556 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8556: Invalid constructor names are accepted in data declarations -------------------------------------+------------------------------------ Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by monoidal): What about `data Foo a = F | (^^^^) a a`? This is promotable, e.g. `Maybe ^^^^ Maybe :: Foo (* -> *)`. My suggestion is to postpone this till implementing KindsWithoutData, and then we can forbid `data Foo a = F | (^^^^) a a` but allow `data kind Foo a = F | (^^^^) a a`. See also #7725. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8556#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8556: Invalid constructor names are accepted in data declarations -------------------------------------+------------------------------------ Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by monoidal): Here's a simple fix for 7.7 discussed on IRC: Writing a data declaration which contains at least one operator not starting with : should require -XDataKinds. So if you write `data A a = (&) a a` you have to enable DataKinds, since the `(&)` is available only in the promoted form. After KindsWithoutData get merged we will forbid it completely by changing the test to unconditional error. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8556#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8556: Invalid constructor names are accepted in data declarations -------------------------------------+------------------------------------- Reporter: dolio | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * priority: normal => low -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8556#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC