[Haskell-cafe] noob question
Daniel Fischer
daniel.is.fischer at web.de
Mon Feb 25 19:48:17 EST 2008
Am Dienstag, 26. Februar 2008 01:32 schrieb Ben:
>
> Ok, that makes sense. There's no num k that's both Fractional and
> Integral, where as in the case where I had the number literals, those
> were two different instances. What's the usual way of working around
> this? Something like
>
> (\k -> (1/ fromInteger k) ^ k) 3
>
> ?
Or use another exponentiation operator, in this case (**),
(\k -> (1/k)**k) :: (Floating t) => t -> t,
so in
(\k -> (1/k)**k) 3,
fromInteger 3 will have type (Floating t) => t and that will be defaulted to
Double
Cheers,
Daniel
More information about the Haskell-Cafe
mailing list