GHCi: Reimplement +c using the same machinery as .hie files
See #16804
This reimplements GHCi :set +c with hie files.
The test case T16804 is marked as broken, as some types can't be deduced, which really should be. But maybe there are other strategies to get that type information.
For example
% executing: ":type-at T16804a.hs 13 14 13 14 undefined"
% file snippet:
> testFunction :: Test -> Test -> Bool
> testFunction A B = True
% ^
> testFunction B A = True
% output:
-undefined :: Test
+undefined :: undefined
% executing: ":type-at T16804a.hs 13 16 13 16 undefined"
% file snippet:
> testFunction :: Test -> Test -> Bool
> testFunction A B = True
% ^
> testFunction B A = True
% output:
-undefined :: Test
+undefined :: undefined
are changes to the test output, which demonstrate a quality reduction sadly.
Also function applications expressions don't carry type information in the hie file, so thats also a reduction of the quality.
But there are also quality improvements especially for :uses
as shown by this
change of the test output:
% executing: ":uses T16804a.hs 13 1 13 12"
% file snippet:
> testFunction :: Test -> Test -> Bool
> testFunction A B = True
% ^~~~~~~~~~~^
> testFunction B A = True
% output:
+T16804a.hs:(12,1)-(12,12)
T16804a.hs:(13,1)-(13,12)
-T16804a.hs:(13,1)-(13,12)
+T16804a.hs:(14,1)-(14,12)
+T16804a.hs:(15,1)-(15,12)
+T16804b.hs:(7,10)-(7,21)
+T16804c.hs:(9,18)-(9,29)
+T16804c.hs:(12,17)-(12,28)
+T16804c.hs:(15,17)-(15,28)
I am willing to invest more time and work into this, but would need some pointers as to which directions I should follow to improve on that.
Please take a few moments to verify that your commits fulfill the following:
-
are either individually buildable or squashed -
have commit messages which describe what they do (referring to Notes and tickets using #NNNN
syntax when appropriate) -
have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places. -
add a testcase to the testsuite. -
replace this message with a description motivating your change
If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR
title with WIP:
.