[GHC] #11416: GHC mistakenly believes datatype with type synonym in its type can't be eta-reduced
GHC
ghc-devs at haskell.org
Mon Feb 15 15:18:48 UTC 2016
#11416: GHC mistakenly believes datatype with type synonym in its type can't be
eta-reduced
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: closed
Priority: normal | Milestone: 8.0.1
Component: Compiler (Type | Version: 8.0.1-rc1
checker) |
Resolution: fixed | Keywords: TypeInType
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:D1772
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Hm, there's another tricky case that I hadn't previously considered:
{{{#!hs
type ConstT a b = a
data family Fam a b
data instance Fam (ConstT a b) b = Fam b deriving Functor
}}}
Currently, the eta-reduction check rejects this. Should it?
On on hand, the `b` in `ConstT a b` will go away if you expand the
`ConstT` type synonym, so one could argue this is no different from `data
instance Fam a b = Fam b deriving Functor` (which is accepted).
On the other hand, if you consider what the derived instance would look
like:
{{{#!hs
instance Functor (Fam (ConstT a b)) where ...
}}}
This feels a bit off, because now the instance head is mentioning an eta-
reduced type variable! But it does typecheck if you type it in manually...
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11416#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list