I have the below simple program to find the average of a list. I know my error is related to the inference of types but I cannot correct it. Can I get a correction and a simple explanation for this?
average :: Float
average= uncurry (/) . sumlen
sumlen ::[Int]-> (Int,Int)
sumlen = foldl f (0,0)
where f (s,n) x = (s+x,n+1)
The error is:
• Couldn't match expected type ‘Float’
with actual type ‘[Int] -> Int’
• Probable cause: ‘(.)’ is applied to too few arguments
In the expression: uncurry (/) . sumlen
In an equation for ‘average’: average = uncurry (/) . sumlen