I need to get the average, so input is stopped until user puts in a negative number and then the output is the average
{
getFloat :: IO Float
getFloat = do line <- getLine
return (read line:: Float)
average :: IO Float
average = helper summ n
where
helper :: Float->Float->IO Float
helper summ n = do val<-getFloat
if (val<0)
then (return average)
else ( do summ = summ + val
n = n+1
average= summ/n
average)
}
?getFloatis broken. Is it the same in your file?