[GHC] #14047: "Illegal instance for type synonym" while deriving Typeable1 for data type

GHC ghc-devs at haskell.org
Fri Jul 28 08:30:25 UTC 2017


#14047: "Illegal instance for type synonym" while deriving Typeable1 for data type
--------------------------------------+---------------------------------
           Reporter:  alexbiehl       |             Owner:  (none)
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:
          Component:  Compiler        |           Version:  8.2.1
           Keywords:                  |  Operating System:  Windows
       Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------------
 This occured to me in `network-ip` package today:

 {{{#!hs
 {-# LANGUAGE StandaloneDeriving #-}
 module Repro where

 import Data.Typeable (Typeable1)

 data InetAddr a = InetAddr
 deriving instance Typeable1 InetAddr
 }}}

 Results in GHC complaining with:

 {{{#!hs
 repro.hs:7:19: error:
     * Illegal instance for a type synonym
       A class instance must be for a class
     * In the stand-alone deriving instance for `Typeable1 InetAddr'
   |
 7 | deriving instance Typeable1 InetAddr
   |                   ^^^^^^^^^^^^^^^^^^
 }}}

 This is due to `Typeable1` defined as type synonym for `Typeable` (see
 here http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-
 Typeable.html#t:Typeable1).

 I can see it is deprecated but I would still expect it to work correctly
 still.

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


More information about the ghc-tickets mailing list