[GHC] #9373: typeable instances incompatible between 7.8 and 7.9

GHC ghc-devs at haskell.org
Mon Jul 28 05:00:04 UTC 2014


#9373: typeable instances incompatible between 7.8 and 7.9
-------------------------------------+-------------------------------------
       Reporter:  carter             |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.2
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 not sure if this is deliberate or by design, but to get some typeable
 instances happy for some DataKind heavy code, if i wish it to build in
 both 7.8 and 7.9, i need to write it in the following form

 {{{#!hs
 {-# LANGUAGE DataKinds, GADTs, TypeFamilies, TypeOperators,
              ConstraintKinds, ScopedTypeVariables, RankNTypes #-}
 data Nat = S !Nat  | Z
     deriving (Eq,Show,Read,Typeable,Data)

 #if defined(__GLASGOW_HASKELL__) && ( __GLASGOW_HASKELL__ >= 707) && (
 __GLASGOW_HASKELL__ < 709)
 deriving instance Typeable 'Z
 deriving instance Typeable 'S
 #endif
 }}}

 if i omit the latter typeables in 7.8, i can't get typeable instances for
 Nat indexed data types, but i get a GHC error if i include them in 7.9
 {{{
     Duplicate instance declarations:
       instance Typeable 'S -- Defined at src/Numerical/Nat.hs:24:28
       instance Typeable 'S -- Defined at src/Numerical/Nat.hs:28:1
 src/Numerical/Nat.hs:24:28:
     Duplicate instance declarations:
       instance Typeable 'Z -- Defined at src/Numerical/Nat.hs:24:28
       instance Typeable 'Z -- Defined at src/Numerical/Nat.hs:27:1
 }}}

 https://travis-ci.org/wellposed/numerical/jobs/31011288#L525 for context

 I can work around it with CPP, but is this a deliberate change or
 accidental? (i'm ok with that CPP being there, but would like some
 confirmation this is a deliberate change)

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


More information about the ghc-tickets mailing list