[Haskell-cafe] newbie q about types

Logesh Pillay lpillay at webafrica.org.za
Sat Feb 2 01:30:02 EST 2008


I have a list.  Each component is a list with 2 whole numbers.  I want 
to multiply the second number by the log of the first
 eg
tail ([519432,525806]) * log (head [519432,525806]).

I get the ffg error message:

 No instance for (Floating [t])
      arising from a use of `log' at <interactive>:1:25-50
    Possible fix: add an instance declaration for (Floating [t])
    In the second argument of `(*)', namely
        `log (head [519432, 525806])'
    In the expression:
          tail ([519432, 525806]) * log (head [519432, 525806])
    In the definition of `it':
        it = tail ([519432, 525806]) * log (head [519432, 525806])


I've tried the only type signature I know "fromIntegral" but it does not 
help.

How to fix?

Thanks
Logesh




More information about the Haskell-Cafe mailing list