Skip to content

Draft: GHCi: Reimplement +c using the same machinery as .hie files

Hannes Siebenhandl requested to merge fendor/ghc:wip/T16804-rebase into master

Rebase of !1425 (closed)

Same caveats apply.

Some tests are marked as broken, as currently the behaviour is:

:set +c
:l T16575.hs
:type-at T16575.hs 4 15 4 18
 :: Int -> X -> ShowS
-- but the previous behaviour doesnt work
:type-at T16575.hs 4 15 4 19
 :: 

This could be mitigated by using selectLargestContainedBy but it doesnt work in some other cases, such as:

module T16569 where

main :: IO ()
main = putStrLn (case (undefined :: Int) of _ -> undefined)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
:set +c
:l T16569.hs
::type-at T16569.hs 4 8 4 59
 :: String -> IO ()
-- although this ought to be `IO ()`.
-- Happens because there is no such span in .HIE with the type `IO ()`.

I would be happy about some pointers on how to move this MR forward.

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.
  • mentions new features in the release notes for the next release

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:.

Edited by Ben Gamari

Merge request reports