Is it possible to query the ghci for the type it inferred for a function inside another function?
This is a quick and ugly hack, but what I usually do is just use the function in the wrong way and read the error message:
inc x = x + 1
where
f (y, z) = y + z
g = f :: Char
GHCi output:
Couldn't match expected type `Char'
against inferred type `(t, t) -> t'
In the expression: f :: Char
Although this leaves out the context Num t =>
, this usually does provide me with enough information to continue.
You might try doing it by setting a breakpoint on it, so the function is in scope from the debugger.
Also I think that EclipseFP can tell you the types of things when you mouse over them, at least some of the time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With