[GHC] #2986: :info printing instances often isn't wanted

GHC ghc-devs at haskell.org
Mon Dec 8 17:16:00 UTC 2014


#2986: :info printing instances often isn't wanted
-------------------------------------+-------------------------------------
              Reporter:  Remi        |            Owner:  Remi
                  Type:  feature     |           Status:  new
  request                            |        Milestone:  7.10.1
              Priority:  lowest      |          Version:  6.10.1
             Component:  GHCi        |         Keywords:  :info instances
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by Remi):

 Thanks for reminding that I want this feature, hvr :)
 I had an unexpected day off work and decided to finally dig up and work a
 bit on that patch:

 {{{
 Prelude> :info Maybe Monad
 data Maybe a = Nothing | Just a         -- Defined in ‘GHC.Base’
 Use `:instances Maybe' to see its 10 instance(s)
 class Applicative m => Monad (m :: * -> *) where
   (>>=) :: m a -> (a -> m b) -> m b
   (>>) :: m a -> m b -> m b
   return :: a -> m a
   fail :: String -> m a
         -- Defined in ‘GHC.Base’
 Use `:instances Monad' to see its 5 instance(s)
 }}}

 And for instances:
 {{{
 Prelude> :instances Maybe Monad
 instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’
 instance Monad Maybe -- Defined in ‘GHC.Base’
 instance Functor Maybe -- Defined in ‘GHC.Base’
 instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’
 instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’
 instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
 instance Applicative Maybe -- Defined in ‘GHC.Base’
 instance Foldable Maybe -- Defined in ‘Data.Foldable’
 instance Traversable Maybe -- Defined in ‘Data.Traversable’
 instance Monoid a => Monoid (Maybe a) -- Defined in ‘GHC.Base’
 instance Monad (Either e) -- Defined in ‘Data.Either’
 instance Monad [] -- Defined in ‘GHC.Base’
 instance Monad Maybe -- Defined in ‘GHC.Base’
 instance Monad IO -- Defined in ‘GHC.Base’
 instance Monad ((->) r) -- Defined in ‘GHC.Base’
 }}}
 {{{
 Prelude> :instances! Monad
 instance Monad Data.Functor.Identity.Identity
   -- Defined in ‘Data.Functor.Identity’
 instance Monad Data.Monoid.Last -- Defined in ‘Data.Monoid’
 instance Monad Data.Monoid.First -- Defined in ‘Data.Monoid’
 instance Monad f => Monad (Data.Monoid.Alt f)
   -- Defined in ‘Data.Monoid’
 instance Monad Text.ParserCombinators.ReadPrec.ReadPrec
   -- Defined in ‘Text.ParserCombinators.ReadPrec’
 instance Monad (GHC.ST.ST s) -- Defined in ‘GHC.ST’
 instance Control.Arrow.ArrowApply a =>
          Monad (Control.Arrow.ArrowMonad a)
   -- Defined in ‘Control.Arrow’
 instance Monad m => Monad (Control.Applicative.WrappedMonad m)
   -- Defined in ‘Control.Applicative’
 instance Monad Data.Proxy.Proxy -- Defined in ‘Data.Proxy’
 instance Monad Text.ParserCombinators.ReadP.ReadP
   -- Defined in ‘Text.ParserCombinators.ReadP’
 instance Monad Text.ParserCombinators.ReadP.P
   -- Defined in ‘Text.ParserCombinators.ReadP’
 instance Monad (Either e) -- Defined in ‘Data.Either’
 instance Monad [] -- Defined in ‘GHC.Base’
 instance Monad Maybe -- Defined in ‘GHC.Base’
 instance Monad IO -- Defined in ‘GHC.Base’
 instance Monad ((->) r) -- Defined in ‘GHC.Base’
 instance Data.Typeable.Internal.Typeable Monad
   -- Defined in ‘Data.Typeable.Internal’
 }}}

 What it doesn't support is at least:
 {{{
 Prelude> :set -XDataKinds

 Prelude> :instances Just
 `Just' is not a type or class

 Prelude> :instances 'Just
 <interactive>:1:1: parse error on input ‘'’

 Prelude> :k 'Just
 'Just :: k -> Maybe k

 Prelude> :k Just
 Just :: k -> Maybe k
 }}}
 However, :info doesn't support it either, so I don't think that's that
 much of an issue right now:
 {{{
 Prelude> :info 'Just
 <interactive>:1:1: parse error on input ‘'’
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2986#comment:27>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list