[GHC] #13154: Standalone-derived anyclass instances aren't as permissive as empty instances
GHC
ghc-devs at haskell.org
Mon Jan 22 19:34:17 UTC 2018
#13154: Standalone-derived anyclass instances aren't as permissive as empty
instances
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: RyanGlScott
Type: bug | Status: patch
Priority: normal | Milestone: 8.6.1
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: | Keywords: deriving
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3337
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Another component of this issue which Iceland_jack noticed is that one
cannot standalone-derive any instances for primitive types, among which
include `(->)`:
{{{#!hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE StandaloneDeriving #-}
module Bug where
import GHC.Exts
class C1 a
deriving instance C1 (a -> b)
class C2 (a :: TYPE 'IntRep)
deriving instance C2 Int#
}}}
{{{
$ ghc/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:11:1: error:
• Can't make a derived instance of ‘C1 (a -> b)’:
The last argument of the instance must be a data or newtype
application
• In the stand-alone deriving instance for ‘C1 (a -> b)’
|
11 | deriving instance C1 (a -> b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:14:1: error:
• Can't make a derived instance of ‘C2 Int#’:
The last argument of the instance must be a data or newtype
application
• In the stand-alone deriving instance for ‘C2 Int#’
|
14 | deriving instance C2 Int#
| ^^^^^^^^^^^^^^^^^^^^^^^^^
}}}
I'll lump this bug under this ticket.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13154#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list