Problem with Infinite Lists

Konrad Hinsen hinsen@cnrs-orleans.fr
Wed, 3 Sep 2003 12:51:21 +0200


On Wednesday 03 September 2003 10:30, Wamberto Vasconcelos wrote:

> Which seems to work:
>
> Main> take 20 all_fib
> [1.0,1.0,2.0,3.0,5.0,8.0,13.0,21.0,34.0,55.0,89.0,144.0,233.0,377.0,
>  610.0,987.0,1597.0,2584.0,4181.0,6765.0]
>
> However, when I tried
>
> Main> filter even (take 20 all_fib)
> ERROR - Illegal Haskell 98 class constraint in inferred type
> *** Expression : filter even (take 20 all_fib)
> *** Type       : Integral Float =3D> [Float]
>
> What is going on here?

"even" wants an integral type for its argument, but you are applying it t=
o a=20
list of floats.

Konrad.