Ticket #10 (new enhancement)
Show types for subexpressions
|Reported by:||nomeata||Owned by:||claus|
not sure if this is possible, but it would be nice to use _t even on locally bound identifiers. So if I have
readTheFile filename = readFile filename
I could hover the filename (either in the pattern or in the body), and it would show "String" or "FileName?".
This could be achieved by temporarily annotating the value with a type signature, e.g.
data Dummy = Dummy readTheFile filename = readFile (filename :: Dummy)
(where Dummy might be replaced by some random string) and then parsing the error message
tmp.hs:2:33: Couldn't match expected type `FilePath' against inferred type `Dummy' In the first argument of `readFile', namely `(filename :: Dummy)' In the expression: readFile (filename :: Dummy) In the definition of `readTheFile': readTheFile filename = readFile (filename :: Dummy)
extracing the type from the "expected type" information.
Additional bonus if it works for subexpression in visual mode. E.g., I can select a range in the code and _t gives me the type of the range (if putting that range in brackets and adding a type signature is still valid code).