[GHC] #3080: Show more instances with :info

GHC trac at galois.com
Sun Mar 8 19:09:21 EDT 2009


#3080: Show more instances with :info
-----------------------------+----------------------------------------------
Reporter:  josef             |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  GHCi            
 Version:  6.10.1            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 Today I was really stumped by the rule used to select which instances are
 shown with the :info command. I did the following:
 {{{
 newtype Control.Monad.Writer.Lazy.Writer w a
   = Control.Monad.Writer.Lazy.Writer {Control.Monad.Writer.Lazy.runWriter
 :: (a,
 w)}
         -- Defined in Control.Monad.Writer.Lazy
 instance Functor (Control.Monad.Writer.Lazy.Writer w)
   -- Defined in Control.Monad.Writer.Lazy
 }}}
 I was really surprised not to see a Monad instance which, after all, is
 the raison d'entre of the Writer type. After some investigation I found
 out that this behavior is a combination of ghci's rule not to show
 instances which involves stuff not in scope and the fact that Monoid
 wasn't in scope.

 Now, personally I tend to want to see everything when I use the :info
 command so my preference would be to see all instances. But I realize that
 you came up with the current rule for a reason and so here are some
 alternative ways how to please me.

 The first one is to have some kind of flag to give to :info so that it
 shows all instances. One might of course make it so that a flag is needed
 to suppress extraneous instances and get the current behavior. That would
 actually be my personal preference.

 Another way, which I'm not sure I like but would at least help in the
 example above, is to note that the type I'm asking about is not in scope
 in the first place. So I'm not interested in 'in scope stuff' at all and
 so showing me all instances, even those including things not in scope,
 isn't very likely to confuse me. This rule would have the rather confusing
 effect of potentially showing less information about stuff that is in
 scope compared to things that are not in scope. But despite this confusing
 consequence I find the rule very sensible, so I'm in two minds about it.

 Anyway, having some way to see all instances would be nice.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3080>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list