[GHC] #8535: :info (->) doesn't print all relevant instances

#8535: :info (->) doesn't print all relevant instances ------------------------------------+------------------------------------- Reporter: parcs | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- I noticed that ":info (->)" does not does not print all relevant instances, specifically instances whose heads use `->` in an infix way. For example, {{{ $ ghci -v0 Prelude> import Data.Monoid Prelude Data.Monoid> :i (->) data (->) a b -- Defined in `GHC.Prim' instance Monad ((->) r) -- Defined in `GHC.Base' instance Functor ((->) r) -- Defined in `GHC.Base' Prelude Data.Monoid> }}} The instance `Monoid b => Monoid (a -> b)` is not printed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8535 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8535: :info (->) doesn't print all relevant instances -------------------------------------+------------------------------------ Reporter: parcs | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by parcs): * status: new => patch Comment: Here's a validated diff that fixes this issue: {{{ #!diff diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index 9ccb08a..430dfb0 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -1316,7 +1316,9 @@ orphNamesOfType (TyVarTy _) = emptyNameSet orphNamesOfType (TyConApp tycon tys) = orphNamesOfTyCon tycon `unionNameSets` orphNamesOfTypes tys orphNamesOfType (LitTy {}) = emptyNameSet -orphNamesOfType (FunTy arg res) = orphNamesOfType arg `unionNameSets` orphNamesOfType res +orphNamesOfType (FunTy arg res) = orphNamesOfTyCon funTyCon `unionNameSets` + orphNamesOfType arg `unionNameSets` + orphNamesOfType res orphNamesOfType (AppTy fun arg) = orphNamesOfType fun `unionNameSets` orphNamesOfType arg orphNamesOfType (ForAllTy _ ty) = orphNamesOfType ty }}} I am not sure how this diff affects the other callers (aside from the ":info" machinery, that is) of `orphNamesOfType`. It passes validation, at least. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8535#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8535: :info (->) doesn't print all relevant instances -------------------------------------+------------------------------------ Reporter: parcs | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 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 simonpj): Great point. I'll commit this. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8535#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8535: :info (->) doesn't print all relevant instances
-------------------------------------+------------------------------------
Reporter: parcs | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: GHCi | Version: 7.6.3
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 Simon Peyton Jones

#8535: :info (->) doesn't print all relevant instances
-------------------------------------+------------------------------------
Reporter: parcs | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: GHCi | Version: 7.6.3
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 Simon Peyton Jones

#8535: :info (->) doesn't print all relevant instances ---------------------------------------+----------------------------------- Reporter: parcs | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: ghci/scripts/T8535 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by simonpj): * status: patch => closed * testcase: => ghci/scripts/T8535 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8535#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC