[GHC] #8486: cannot derive new-typeable instances for promoted data types taking parameters

#8486: cannot derive new-typeable instances for promoted data types taking parameters ------------------------------------+------------------------------------- Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- Hi, The following code shows the issue: {{{ {-# LANGUAGE DataKinds, DeriveDataTypeable, KindSignatures, PolyKinds, StandaloneDeriving #-} import Data.Typeable import GHC.TypeLits data T (a :: [*]) = T deriving (Typeable) t = T :: T [Int, Double] deriving instance Typeable '[] {- *Main> typeOf t <interactive>:24:1: No instance for (Typeable (* -> [*] -> [*]) ((':) *)) arising from a use of ‛typeOf’ In the expression: typeOf t In an equation for ‛it’: it = typeOf t -} }}} ghc7.7-20131004 doesn't allow either of the following: {{{ deriving instance (Typeable a, Typeable b) => Typeable (a ': b) -- or deriving instance Typeable (':) }}} On ghc-7.6 I could write my own `instance Typeable (T a)`, but this has been disabled it seems. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by aavogt): It seems I can do `deriving instance Typeable Left`, so maybe it's just a minor adjustment to the parser needed? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by monoidal): See also #5682. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 5682 -------------------------------------+------------------------------------ Changes (by dreixel): * related: => 5682 Comment: Yes, I think this is another instance of #5682. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 5682 -------------------------------------+------------------------------------ Comment (by goldfire): I'm working on #5682, but I would think that `Typeable` instances for data constructors exported from base should also be exported from base. Otherwise, there will be orphan instances that might conflict. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 5682 -------------------------------------+------------------------------------ Comment (by dreixel): I agree. But currently we can't even define those instances in base. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 5682 -------------------------------------+------------------------------------ Comment (by goldfire): #5682 is now fixed in HEAD, so these instances should indeed be definable. I suppose we can be sure that users don't define instances (because they wouldn't parse), so if this gets fixed in time in `base`, that might be mergeable into 7.8.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 5682 -------------------------------------+------------------------------------ Changes (by aavogt): * status: new => closed * resolution: => fixed Comment: The instance is missing from 7.8.1's base. But I can now define the orphan myself. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------ Reporter: aavogt | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 5682 -------------------------------------+------------------------------------ Comment (by goldfire): Just posted #9111 requesting that `base` export these instances. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8486: cannot derive new-typeable instances for promoted data types taking parameters -------------------------------------+------------------------------------- Reporter: aavogt | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: 5682 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by hvr): * milestone: => 7.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8486#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC