NumDecimals detection of integral literals is broken
Summary
According to the documentation of NumDecimals
any integral literal in scientific notation will desugar into using fromInteger
, rather than fromRational
. However, the logic for detecting whether a literal is integral seems to be broken. This seems to (mostly?) affect literals with large exponents.
Steps to reproduce
Enable -XNumDecimals
in ghc or ghci, compile any code including (1e101 :: Integer)
. This produces a type error:
• No instance for (Fractional Integer) arising from the literal ‘1e101’
Confusingly, (10e100 :: Integer)
works just fine, despite evaluating to the same value.
Expected behavior
This should compile without error.
Environment
- GHC version used: 9.2, 9.4, and 9.6 (possibly far earlier to, but I didn't test)
Optional:
- Operating System:
- System Architecture: