Skip to content

Language.Haskell.TH.pprLit hangs on rational literals too large for Double

Summary

As a consequence of !7151 (closed) (sorry!), the TH pretty-printer hangs when given a numeric literal that's too large to be represented as a Double.

Steps to reproduce

$ ghci -package template-haskell
GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help
ghci> :module Language.Haskell.TH
ghci> pprLit 0 (RationalL 1e310)
^C^C^C
Interrupted.

Expected behavior

ghci> pprLit 0 (RationalL 1e300)
10e299

Environment

  • GHC version used: 9.6.2

Optional:

  • Operating System: Linux
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information