GHCi output of :info (~) gives wrong superclass
Summary
GHCi's :info output for the type equality constraint operator (~) is really misleading.
λ> :info (~)
class (a ~ b) => (~) (a :: k) (b :: k)
-- Defined in ‘Data.Type.Equality’
According to the output printed here, this appears to be a circular constraint: a ~ b implies a ~ b. And it contradicts the source code for the Data.Type.Equality module, which says:
class a ~~ b => (a :: k) ~ (b :: k)
The documentation for (~~) gives the explanation:
this is printed as
~unless-fprint-equality-relationsis set.
And indeed, if -fprint-equality-relations is set, then :info (~) produces the expected output.
λ> :set -fprint-equality-relations
λ> :info (~)
class (a ~~ b) => (~) (a :: k) (b :: k)
-- Defined in ‘Data.Type.Equality’
I must confess I don't really understand the rationale for why ~~ is normally printed as ~, so it's possible that my suggestion here is off-base; but it seems to me that in this context (perhaps only in this context) ~~ should be printed as ~~ regardless of how the flags are set.
Steps to reproduce
Open a new GHCi session and type :info (~)
Expected behavior
Print output that begins with the following line:
class (a ~~ b) => (~) (a :: k) (b :: k)
Environment
- GHC versions tested:
- 8.6.5
- 8.8.1