[GHC] #13584: ghci parse error on operator info

GHC ghc-devs at haskell.org
Sun Jun 24 16:48:14 UTC 2018


#13584: ghci parse error on operator info
-------------------------------------+-------------------------------------
        Reporter:  akegalj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  lowest            |            Milestone:
       Component:  GHCi              |              Version:  8.0.2
      Resolution:                    |             Keywords:  parse, info,
                                     |  operator
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by anarchist666):

 The {{{words}}} operator is used in the {{{:info}}} command.
 {{{
 info :: Bool -> String -> InputT GHCi ()
 info _ "" = throwGhcException (CmdLineError "syntax: ':i <thing-you-want-
 info-about>'")
 info allInfo s  = handleSourceError GHC.printException $ do
     unqual <- GHC.getPrintUnqual
     dflags <- getDynFlags
     sdocs  <- mapM (infoThing allInfo) (words s)
 mapM_ (liftIO . putStrLn . showSDocForUser dflags unqual) sdocs
 }}}
 But you can type {{{:info + -}}} and get this

 {{{
 class Num a where
   (+) :: a -> a -> a
   ...
         -- Defined in ‘GHC.Num’
 infixl 6 +
 class Num a where
   (-) :: a -> a -> a
   ...
         -- Defined in ‘GHC.Num’
 infixl 6 -
 }}}
 We can filter all brackets in the input line, but I want to know what the
 others think about it.

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


More information about the ghc-tickets mailing list