[GHC] #8707: Kind inference fails in data instance definition
GHC
ghc-devs at haskell.org
Fri Feb 28 10:01:55 UTC 2014
#8707: Kind inference fails in data instance definition
-------------------------------------+------------------------------------
Reporter: goldfire | Owner: jstolarek
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by jstolarek):
> 2) The error message is not particularly helpful. GHC 7.6.3 had a more
verbose, but more helpful message.
Code responsible for this difference is here
[[GhcFile(compiler/types/TypeRep.lhs#L711)]] in the function `pprTcApp`:
{{{
| Just dc <- isPromotedDataCon_maybe tc
, let dc_tc = dataConTyCon dc
, isTupleTyCon dc_tc
, let arity = tyConArity dc_tc -- E.g. 3 for (,,) k1 k2 k3 t1 t2 t3
ty_args = drop arity tys -- Drop the kind args
, ty_args `lengthIs` arity -- Result is saturated
= pprPromotionQuote tc <>
(tupleParens (tupleTyConSort dc_tc) $
sep (punctuate comma (map (pp TopPrec) tys)))
}}}
The only question is how we want the arguments printed? GHC 7.6 prints
them like this:
{{{
Data constructor `SFalse' returns type `SingDF
Bool k ('(,) Bool (k -> *)
'False (Ctor k))'
instead of an instance of its parent type `SingDF Bool Bool a'
}}}
GHC HEAD prints tuple constructors in the standard notation (not prefix as
seen in GHC 7.6 output):
{{{
Data constructor ‘SFalse’ returns type ‘SingDF
Bool k '(Bool, k -> *, 'False,
Ctor k)’
instead of an instance of its parent type ‘SingDF Bool Bool a’
}}}
But printing kinds as part of a tuple is misleading. Any suggestions how
should the output look like?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8707#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list