[GHC] #8258: GHC accepts `data Foo where` in H2010 mode

GHC ghc-devs at haskell.org
Mon Sep 9 10:49:15 CEST 2013


#8258: GHC accepts `data Foo where` in H2010 mode
--------------------------+------------------------------------------------
       Reporter:  hvr     |             Owner:
           Type:  bug     |            Status:  new
       Priority:  low     |         Milestone:  7.8.1
      Component:          |           Version:  7.0.4
  Compiler                |  Operating System:  Unknown/Multiple
       Keywords:          |   Type of failure:  GHC accepts invalid program
   Architecture:          |         Test Case:
  Unknown/Multiple        |          Blocking:
     Difficulty:          |
  Unknown                 |
     Blocked By:          |
Related Tickets:          |
--------------------------+------------------------------------------------
 According to the Haskell2010 report,

 The grammar productions relevant for `data` declarations are the
 following:

 {{{
 topdecl → data [context =>] simpletype [= constrs] [deriving]
 }}}

 (from
 [http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-680004.2
 4.2.1 Algebraic Datatype Declarations])

 However, GHC 7.0.4/7.4.2/7.6.3/HEAD all happily compile the following
 Haskell module without any warning when using `-XHaskell2010 -Wall`, even
 though this is not valid Haskell2010 afaik:

 {{{#!hs
 module Foo where

 data Foo where
 }}}

 The trailing `where` in the `data` declaration is not valid Haskell2010
 (without language extensions such as `GADT`).

 At the very least, this divergence from the Haskell Report should be
 mentioned in [http://www.haskell.org/ghc/docs/latest/html/users_guide
 /bugs-and-infelicities.html#haskell-standards-divergence 14.1.1.
 Divergence from Haskell 98 and Haskell 2010].

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8258>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list