[GHC] #15052: DeriveAnyClass instances may skip TypeError constraints

GHC ghc-devs at haskell.org
Wed Apr 18 10:39:05 UTC 2018


#15052: DeriveAnyClass instances may skip TypeError constraints
-------------------------------------+-------------------------------------
        Reporter:  jcpetruzza        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 You say that the equivalent instance is "rejected right away using a
 normal instance declaration or StandaloneDeriving", but I can't reproduce
 this behavior. In fact, these three equivalent instances all typecheck:

 {{{#!hs
 {-# LANGUAGE DeriveAnyClass       #-}
 {-# LANGUAGE DataKinds            #-}
 {-# LANGUAGE FlexibleContexts     #-}
 {-# LANGUAGE StandaloneDeriving   #-}
 {-# LANGUAGE UndecidableInstances #-}
 {-# LANGUAGE UndecidableSuperClasses #-}
 module T where

 import GHC.TypeLits(TypeError, ErrorMessage(..))

 class TypeError ('Text "BOOM") => C a where
     f :: a -> ()
     f _ = ()

 data T1 = T1
    deriving C

 data T2 = T2
 instance TypeError ('Text "BOOM") => C T2

 data T3 = T3
 deriving instance TypeError ('Text "BOOM") => C T3
 }}}

 Am I missing something here?

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


More information about the ghc-tickets mailing list