Is there any way to print out the inferred type of a nested variable in ghci
? Consider the code,
let f = g where
g (x :: Int) = x
then, it'd be nice to query the type of g
, e.g. :t f.g
would print out Int -> Int
.
You can coax this information out by giving an appropriately wrong type annotation and checking the error message.
*Main> let f = g where g::a; g (x::Int) = x
<interactive>:1:23:
Couldn't match type `a1' with `Int -> Int'
`a1' is a rigid type variable bound by...