Type checking/inference
s_mazanek at gmx.de
s_mazanek at gmx.de
Sun Dec 28 10:08:02 EST 2003
Hi,
> prelude> :t map (foldr filter)
> map (foldr filter) :: [[a]] -> [[a -> Bool] -> [a]]
>
> Two main questions:
> 1/ How does hugs derive this answer?
> 2/ What input can I give so that it yields a correct result? I've tried
> giving it a list of lists but it fails...
Try:
map (flip (foldr filter) [even,odd]) [[1,2,3],[4,5,6]]
I guess this meets your expectation.
Without flipping the arguments:
Prelude> map (foldr filter [1,2,3]) [[even]]
[[2]]
Prelude> map (foldr filter [1,2,3]) [[even],[even,odd]]
[[2],[]]
Prelude> map (foldr filter [1,2,3]) [[even],[even,odd],[odd]]
Bye,
Steffen
More information about the Haskell-Cafe
mailing list