[Haskell-cafe] filterFirst

Alexteslin alexteslin at yahoo.co.uk
Mon Jul 23 14:24:49 EDT 2007


Hi,
first I like to thank all of you guys - it really helps!

I am still on a same chapter with higher order functions and this function
is also confusing.
But before i even define this function i am getting the type error - i don't
know why? So i wrote the simpler one like:

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

To even my very little knowledge i think that this should work. What am i
doing wrong?

Thanks again  
-- 
View this message in context: http://www.nabble.com/filterFirst-tf4131377.html#a11749336
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list