[GHC] #13813: DeriveFunctor spuriously rejects existential context with type synonym mentioning the last type variable

#13813: DeriveFunctor spuriously rejects existential context with type synonym mentioning the last type variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This code does not compile: {{{#!hs {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE StandaloneDeriving #-} module Bug where import GHC.Exts (Constraint) type C (a :: Constraint) b = a data T a b = C (Show a) b => MkT b deriving instance Functor (T a) }}} {{{ GHCi, version 8.2.0.20170523: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:13:1: error: • Can't make a derived instance of ‘Functor (T a)’: Constructor ‘MkT’ must be truly polymorphic in the last argument of the data type • In the stand-alone deriving instance for ‘Functor (T a)’ | 13 | deriving instance Functor (T a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} But it should, since if you expand `C (Show a) b`, you're left with `Show a`, which doesn't mention the last type variable `b` at all. Fix incoming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13813 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13813: DeriveFunctor spuriously rejects existential context with type synonym mentioning the last type variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3635 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3635 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13813#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13813: DeriveFunctor spuriously rejects existential context with type synonym
mentioning the last type variable
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3635
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#13813: DeriveFunctor spuriously rejects existential context with type synonym mentioning the last type variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | deriving/should_compile/T13813 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3635 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => deriving/should_compile/T13813 * status: patch => closed * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13813#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC