[GHC] #11348: Local open type families instances ignored during type checking
GHC
ghc-devs at haskell.org
Tue Jan 5 19:18:28 UTC 2016
#11348: Local open type families instances ignored during type checking
-------------------------------------+-------------------------------------
Reporter: alexvieth | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1-rc1
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):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by alexvieth):
> Why should the instance declarations affect the kind of the type
constructor?
We could always find type families mentioned in GADT data constructors,
but with GADT data constructor promotion, we can therefore find these
families mentioned in kinds:
{{{#!hs
type family TrivialFamily (t :: Type) :: Type
type instance TrivialFamily t = Bool
data Q where
Q :: TrivialFamily Int -> Q
-- The type of the data constructor
Q :: Bool -> Q
-- The kind of the promoted data constructor.
-- GHC actually gives 'Q :: TrivialFamily Int -> Q
-- but it *should* flatten that to Bool.
'Q :: Bool -> Q
-- This will not kind-check, unless we import the
-- TrivialFamily t instance.
type Problem = 'Q 'True
}}}
To check that a use of `'Q` is well-kinded, we must know `TrivialFamily
Int`. Pardon my earlier comment, this bug can arise ''without'' switching
on `TypeInType`.
> If you're up to this task, that would be wonderful.
Absolutely. This bug is blocking a project of mine so I want it fixed
asap.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11348#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list