[GHC] #15646: ghci takes super long time to find the type of large fractional number

GHC ghc-devs at haskell.org
Tue Sep 18 04:38:49 UTC 2018


#15646: ghci takes super long time to find the type of large fractional number
-------------------------------------+-------------------------------------
        Reporter:  Johannkokos       |                Owner:
                                     |  JulianLeviston
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  GHCi              |              Version:  8.4.3
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 > The literal 1e100 means fromRational (100...000 :: Rational), as
 specified in
 > Haskell report

 Where is this specified in the report? I can see the syntax in section 2.5
 which links to sections 3.4 and 6.4.1 but I can't see this rule in any of
 those
 linked sections. Can't find where the semantics for this literal is
 defined.

 > It's not surprising it crashes badly when the exponent has 10 digits or
 more.

 Wait, are you saying that typing `1e1234111111111111111111111` to take
 minutes
 and use up more than 20G of memory (residence, not allocation!) not
 surprising?
 Perhaps I'm completely lost then. Could you elaborate on how is this not
 surprising?

 FWIW I just typed in that expression in Python REPL and it gave me an
 answer in
 an instant.

 > With -XNumDecimals, we need to process the literal before we can tell
 its
 > type: 1.234e3 is a valid Integer but 1.234e2 is not.

 I'm still not convinced that we can't do better but OK. At the very least
 we
 should be able to type those expressions quickly when `-XNumDecimals` is
 not
 enabled (which is the default).

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


More information about the ghc-tickets mailing list