Skip to content

T23686: Suggest how to enable Language Extension when in ghci

psilospore - Syed Jafri requested to merge psilospore/ghc:T23686 into master

Thank you for your contribution to GHC!

Please read the checklist below to make sure your contribution fulfills these expectations. Also please answer the following question in your MR description:

Where is the key part of this patch? That is, what should reviewers look at first?

See: #23686 (closed)

When using a feature that requires a language extension in a repl it would be nice for ghci to suggest how to enable that extension. Currently, it will show:

ghci> data family GMap k :: * -> *

error:
     Illegal family declaration for GMap
        Enable TypeFamilies to allow indexed type families
     In the data family declaration for GMap

This will add a suggestion on how to enable the extension in ghci:

      You may enable language extension(s) with:
      :set -XTypeFamilies

If a user needs to enable multiple extensions together then it should look like:

      You may enable language extension(s) with:
      :set -XTypeFamilies -XGADTs -XDataKinds

If a user needs to enable 1 of several extensions then it will have each command on a new line:

      You may enable language extension(s) with:
      :set -XTypeFamilies
      :set -XGADTs
      :set -XDataKinds

Please take a few moments to address the following points:

  • if your MR may break existing programs (e.g. touches base or causes the compiler to reject programs), please describe the expected breakage and add the user-facing label. This will run ghc/head.hackage> to characterise the effect of your change on Hackage.
  • ensure that your commits are either individually buildable or squashed
  • ensure that your commit messages describe what they do (referring to 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. Is there a good way to update all the tests?
  • updates the users guide if applicable
  • 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:.

By default a minimal validation pipeline is run on each merge request, the full-ci label can be applied to perform additional validation checks if your MR affects a more unusual configuration.

Once your change is ready please remove the WIP: tag and wait for review. If no one has offerred review in a few days then please leave a comment mentioning @triagers and apply the Blocked on Review label.

Edited by psilospore - Syed Jafri

Merge request reports