At 2001-11-12 18:06, Jesper Louis Andersen wrote:

>mean            :: (Fractional a) => [a] -> a
>mean l          = (sum l)/ fromIntegral (length l)
>
>Which imposes a type constraint (of course). My problem is, that i
>cannot ``let go'' of this constraint. 

...
>main           :: Fractional Int => IO ()

It sounds like you're trying to use your 'mean' function on Ints. Int is 
not a Fractional type (unless you make it one), and so '/' isn't defined 
on it.

What's "mean [3::Int,4::Int]"? It can't be "3.5::Int" because 3.5 is not 
an integer and so not an Int.

-- 
Ashley Yakeley, Seattle WA


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to