Alexteslin wrote:
> filterAlpha :: (a -> Bool) -> [a] -> [a]
> filterAlpha f [] = []
> filterAlpha f (x:xs)
> |f x = x : filterAlpha xs
> |otherwise = filterAlpha xs
>
>
> and i am getting this error message:
>
> Type error in application
> Expression :filterAlpha xs
> Type : [b]
> Dous not match : a -> Bool
filterAlpha :: (a -> Bool) -> [a] -> [a]
filterAlpha f [] = []
filterAlpha f (x:xs)
| f x = x : filterAlpha f xs
| otherwise = filterAlpha f xs
filterAlpha has two parameters. The first parameter is a function (a ->
Bool), the second is a list [a]. The error message complains that xs ,
which you actidentially gave as first parameter, is a list [a] and not a
function (a -> Bool).
Regards,
apfelmus
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe