Opened 5 years ago

Closed 5 years ago

#9373 closed bug (invalid)

typeable instances incompatible between 7.8 and 7.9

Reported by: carter Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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

{-# 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)

Change History (1)

comment:1 Changed 5 years ago by simonpj

Resolution: invalid
Status: newclosed

I'm afraid it's deliberate: #8950. Unless you want to argue to reverse the design decision taken there.

Simon

Note: See TracTickets for help on using tickets.