[GHC] #15842: Exponentiation needs PrelRules
GHC
ghc-devs at haskell.org
Thu Nov 1 17:21:35 UTC 2018
#15842: Exponentiation needs PrelRules
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.6.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Runtime
Unknown/Multiple | performance bug
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
When a user writes `a ^ lb`, where `lb` is an integer literal, the type of
`lb` defaults to `Integer` unless it's annotated. If `lb` is very small,
then `RULES` will expand the whole expression into a few multiplications.
If not, the computation will pay the price of `Integer` arithmetic. If we
want, we should be able to improve this with a special compilation rule.
When `lb :: Integer`, and `0 <= lb <= maxBound :: Word`, we should be able
to replace `lb` by the equivalent `Word`. The same problem appears with
`^^` and `stimes`. Perhaps those can be fixed up as well, somehow.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15842>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list