Type checking

2003-12-31 Thread Lee Dixon
Hi,

Can anyone explain to me how hugs manages to derive that

f x y z = y (y z) x

is of type

f :: a - ((a - b) - a - b) - (a - b) - b

Many thanks and a happy new year to all!

Lee

_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Type checking/inference

2003-12-27 Thread Lee Dixon
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

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe