Martijn van Steenbergen <[email protected]> writes:
>
> 1) What's a type of this function? I say *a* type because there are
> multiple correct answers.
>
>> debugWith f = do
>>   putStrLn (f True)
>>   putStrLn (f 'c')
>
> Don't ask the compiler to infer the type for you; it won't be able
> to. One of the characteristics of RankNTypes is that the compiler
> needs you, the programmer, to supply the type.

I randomly guess something like "(forall a. a -> String) -> IO ()" (but
haven't done anything myself with existentials so I'm quite possibly
wrong).

> 2) What would be a good argument to debugWith?

Does "show" suffice?

> 3) What's one reason the compiler can't infer the type for you?

foralls are tricksy little devils? :p

-- 
Ivan Lazar Miljenovic
[email protected]
IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to