[GHC] #15791: typeKind confuses Type and Constraint
GHC
ghc-devs at haskell.org
Mon Oct 22 19:04:17 UTC 2018
#15791: typeKind confuses Type and Constraint
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The `typeKind` function takes a type and reports its kind. It gets this
wrong, sometimes: if you ask for `typeKind` of the quantified constraint
`Eq a => C a` (where `C` is a class), you get `Type`. This is wrong,
though I don't have a concrete case where GHC misfires.
We ''could'' fix `typeKind` to get this right, but doing so would require
making the `FunTy` case recursive (right now, it always returns `Type`).
This is wasteful, because most clients of `typeKind` do not care about the
distinction between `Type` and `Constraint`.
Instead, I propose making a new `tcTypeKind` which behaves correctly in
this case.
We could also muse about making `tcTypeKind` monadic so that it can look
through unification variables. This might also simplify the story around
`Note [The tcType invariant]`.
Regardless of the "make monadic" idea, I claim that, when this is done, we
should have `isPredTy` be functionally equivalent to `(== Constraint) .
tcTypeKind`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15791>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list