[Haskell-cafe] noob question
Henning Thielemann
lemming at henning-thielemann.de
Tue Feb 26 02:35:16 EST 2008
On Tue, 26 Feb 2008, Philippa Cowderoy wrote:
> On Mon, 25 Feb 2008, Ben wrote:
>
> > <interactive>:1:8:
> > Ambiguous type variable `t' in the constraints:
> > `Fractional t' arising from a use of `/' at <interactive>:1:8-10
> > `Integral t' arising from a use of `^' at <interactive>:1:7-15
> > Probable fix: add a type signature that fixes these type variable(s)
> >
>
> / doesn't do integer division, so from there it concludes that you're
> working with a Fractional type - Haskell never coerces behind your back,
> so not only the result of / but also its parameters are Fractional.
>
> ^ only works for Integral types. You might consider that a little
> arbitrary, but hey - it's mostly like that because it's much easier to
> raise something to an integer power.
http://www.haskell.org/haskellwiki/Power_function
More information about the Haskell-Cafe
mailing list