[GHC] #14916: Missing checks when deriving special classes

GHC ghc-devs at haskell.org
Mon Mar 26 01:06:51 UTC 2018


#14916: Missing checks when deriving special classes
-------------------------------------+-------------------------------------
        Reporter:  kosmikus          |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.4.2
       Component:  Compiler (Type    |              Version:  8.2.2
  checker)                           |
      Resolution:  fixed             |             Keywords:  Deriving
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4501
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * status:  patch => closed
 * resolution:   => fixed
 * milestone:   => 8.4.2


Old description:

> For the following program
> {{{
> {-# LANGUAGE DeriveAnyClass #-}
> module T where
>
> import Data.Coerce
> import Data.Typeable
>
> data A = MkA deriving ((~) A)
> data B = MkB deriving (Coercible B)
> }}}
> the deriving clause for `A` is accepted without complaints, and the
> deriving clause for `B` fails with the following error:
> {{{
> T.hs:8:24: error:
>     Top-level bindings for unlifted types aren't allowed:
>   |
> 8 | data B = MkB deriving (Coercible B)
>   |                        ^^^^^^^^^^^
> }}}
>
> Corresponding standalone deriving instances trigger errors
> saying "Manual instances of this class are not permitted".
> Probably similar error messages should be triggered here.

New description:

 For the following program
 {{{#!hs
 {-# LANGUAGE DeriveAnyClass #-}
 module T where

 import Data.Coerce
 import Data.Typeable

 data A = MkA deriving ((~) A)
 data B = MkB deriving (Coercible B)
 }}}
 the deriving clause for `A` is accepted without complaints, and the
 deriving clause for `B` fails with the following error:
 {{{
 T.hs:8:24: error:
     Top-level bindings for unlifted types aren't allowed:
   |
 8 | data B = MkB deriving (Coercible B)
   |                        ^^^^^^^^^^^
 }}}

 Corresponding standalone deriving instances trigger errors
 saying "Manual instances of this class are not permitted".
 Probably similar error messages should be triggered here.

--

Comment:

 Merged to `ghc-8.4`.

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


More information about the ghc-tickets mailing list