views:

107

answers:

2

I am trying to do following:

10 ** length xs * x

but I get:

No instance for (Floating Int) arising from a use of `**'

+7  A: 

You can use ^ to raise to an integral power. There's no need to convert to float here.

sepp2k
Thanks, it seems to work :)
MMM
+5  A: 

Besides @sepp2k's answer, if you somehow really need to convert from an integer to some other types of Num, use fromIntegral.

-- # fromIntegral :: (Integral a, Num b) => a -> b

10 ** fromIntegral (length xs) * x
KennyTM