Hello,
I tried to write function mean - average of numeric list.
mean::(Fractional a)=>[a]->a
mean a = (realToFrac (sum a)) / (realToFrac (length a))
But error occures:
Could not deduce (Real a) from the context (Fractional b)
arising from a use of `realToFrac'
To correct this function, i rewrite this function:
mean::(Real a, Fractional a)=>[a]->b
mean a = (realToFrac (sum a)) / (realToFrac (length a))
Is there most simple way to write this function?
Thanks, Nadav