Matthias Fischmann <[EMAIL PROTECTED]> writes: > avg :: (FractionalOrIntegral a) => [a] -> a > avg xs = sum (map fromFractionalOrIntegral xs) / (fromIntegral (length xs))
Your condition is probably too strong. For one thing, there is no need to convert every element of the list being summed, just its result. Also, does the final result need to be the same type as the elements? avg :: (Num a, Fractional b) => [a] -> b avg xs = fromRational (sum xs % toInteger (length xs)) Regards, Malcolm _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe