some specializations / optimized instances might be found in http://hackage.haskell.org/package/arithmoi

cheers
-Carter

On Thu, Nov 1, 2018 at 1:24 PM David Feuer <david.feuer@gmail.com> wrote:
We currently have

  (^) :: (Num a, Integral b) => a -> b -> a
  (^^) :: (Fractional a, Integral b) => a -> b -> a
  stimes :: (Semigroup a, Integral b) => b -> a -> a

These are very general, but the ergonomics are terrible. The trouble
is that in each case, the `b` type variable is a (constrained) type
that appears only in one argument and not in the result. In the
extremely common case where the exponent is a literal, we rely on
defaulting to fix `b ~ Integer`. When the exponent is very small, it
will then be rewritten to a simple multiplication. Otherwise, it will
pay the price of bignum arithmetic, whether that's required or not.

Is there a canonical package providing versions of these functions
with the exponent specialized to `Int` and/or `Word`? If not, where
might such fit well?
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries