
Then we could add `(^)` as a method of Num a, change its type to be `(^) :: a -> a -> a` and use the appropriate primitives (or fall back to the generic implementation otherwise). Exactly like we do for other
#16372: GHC can't constant fold even basic power (^) applications for Int (and others?) -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hsyl20): primitives. Hmm in fact it won't work for non integral `Num` types (e.g., Double)... Maybe we could add another function (`ipow`?) to `Integral` instead and add rules to convert `(^)` into `ipow` for known cases. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16372#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler