[GHC] #15330: Error message prints invisible kind arguments in a visible matter
GHC
ghc-devs at haskell.org
Mon Jul 2 13:57:00 UTC 2018
#15330: Error message prints invisible kind arguments in a visible matter
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.8.1
Component: Compiler (Type | Version: 8.4.3
checker) |
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: Poor/confusing | Unknown/Multiple
error message | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Unlike its cousin #15308, this ticket looks quite tricky to fix. The
difference between pretty-printing the types of `f1` and `f2` is
essentially the difference between pretty-printing `TyConApp` and `AppTy`.
With `TyConApp`, we have convenient access to the kind of the underlying
type constructor, which makes it simple to tell which of its arguments are
visible or not. As an example, when we convert a `Type` to an `IfaceType`
in `toIfaceTypeX`, we use this tycon kind information to convert the
arguments of the tycon to `IfaceTcArgs`. Then, when pretty-printing a
`Type`, we first convert to an `IfaceType`, and then determining which
arguments of an `IfaceTyConApp` to print is a simple matter of checking
for `ITC_Vis` or `ITC_Invis`.
Things are tricker with `AppTy`. The type being applied in `AppTy` does
not have its kind cached //a priori//, so in order to pretty-print `AppTy`
analogously to how we pretty-print `TyConApp`, it seems like we'd have to:
1. Use `typeKind` to get the kind of the type being applied
2. Gather all of the arguments to the type (à la `collectArgs` for
`Expr`s)
3. Tag which arguments are invisible (à la `IfaceTcArgs`)
This sounds mighty gruesome, but I can't think of a simpler solution at
the moment. Thoughts?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15330#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list