FR
PréludeChargé par défaut — aucun import nécessaire.

Exponentiation — one (^) dispatched on the exponent type

Synopsis
interface Pow a b where
(^) : a -> b -> a

a ^ b raises a to the power b (infixr 8, binds tighter than *). A single operator dispatched on the exponent type, unifying Haskell's ^/^^/**:

  • a ^ Nat — repeated multiplication, for any Multiplicative a;
  • a ^ Int — integer power, negative exponents via recip

(DivisionRing a);

  • Double ^ Double — real power.

There is deliberately no Int ^ Int: 3 ^ (-2) has no Int result, so Int (not a DivisionRing) only admits a Nat exponent.

Instances : Double
funPow : (a -> a) -> Nat -> a -> a