I am attempting to raise a number which is of type RealFrac
to the power of another number, also of type RealFrac
. This question on exponentiation helpfully explains the various exponentiation functions in Haskell, and I believe I need to use (^)
in order to preserve any non integer values. But how do I deal with the types? I keep coming up against errors like this:
Could not deduce (Integral a) arising from a use of ‘^’
from the context (RealFrac a)
bound by the type signature for
splitFunc :: RealFrac a => a -> a -> a
at Procedural/City.hs:41:16-42
Possible fix:
add (Integral a) to the context of
the type signature for splitFunc :: RealFrac a => a -> a -> a
In the expression: r ^ l
In an equation for ‘splitFunc’: splitFunc r l = r ^ l