Type checking/inference
Lee Dixon
leedixon_2 at hotmail.com
Sun Dec 28 04:58:12 EST 2003
Hi,
I've run into a small problem whilst doing some manual type checking, to see
if I could match the results given by hugs
prelude> :t foldr filter
foldr filter :: [a] -> [a -> Bool] -> [a]
-- This was fine and was the same as my answer, so I tested it with
prelude> foldr filter [1,2,3,4] [even,odd]
-- and the answer was indeed an empty list
-- However I got stuck when attempting to derive the result of
map (foldr filter)
-- Hugs says that:
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...
Any pointers would be greatly appreciated!
Many Thanks,
Lee
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger
More information about the Haskell-Cafe
mailing list