[Haskell-cafe] filterFirst

Alexteslin alexteslin at yahoo.co.uk
Mon Jul 23 15:47:47 EDT 2007




apfelmus wrote:
> 
> 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
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

Oh silly me.  I defined firstFirst now, thank you.

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



More information about the Haskell-Cafe mailing list