(/) operates on a Fractional instance... but length returns an Int, which is not a Fractional.
Hi guys,I just started learning some Haskell. I want to implement a mean function to compute the mean of a list. The signature of the function is:mean :: (Num a, Fractional b) => [a] -> bBut when I implement this simple function, the compiler keep whining at me on type errors. I know this is wrong:mean xs = sum xs / length xsBut how to get it right? Thanks.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe