Bash completion in GHC 7.10

Lennart Kolmodin kolmodin at
Wed Dec 10 12:43:57 UTC 2014

Hi everybody!

TL;DL GHC 7.10 will have better bash completion, try it out! I'd like your
help to verify the categorisation of DynFlags into ghc / ghci / shared or
hidden flags.

I've been working on improving the command line completion support in GHC

The main idea is that it should be more convenient to use GHC from the
command line, without knowing all the flags by heart. You should be able to
partly type a flag and then hit TAB twice to display the possible
completions. For example;

 $ ghc -f<TAB><TAB>

If you'd like to try it out, here's what you need to do;

 $ cd ghc-head
 $ source completion/ghc.bash

Et voilà! Your bash shell will now have these super powers!
There's a README
<> with
details for a permanent setup.
End users should ultimately not have to do anything to get this working.
Linux distributions, and packages for other OSs are responsible for copying
the required file to the right location.

GHC had some basic support for command line completion even before my work,
but now it also includes two significant changes compared to GHC 7.8;

   - "ghc" and "ghci" has different completions.
   - GHC 7.10 will ship and maintain the necessary bash components (and the
   scripts you contribute for other shells!).

To support different completions for ghc and ghci, the DynFlags have been
annotated with which mode the flags works. How this works has been
documented under "Note [Supporting CLI completion]".

Essentially all flags have been divided into four groups;

   - Flags only useful for ghc
   - Flags only useful for ghci
   - Flags useful from both ghc and ghci
   - Flags that should be invisible

I've made this categorisation best I could, but it'd be nice to have
another few pair of eyes glance through the flags.

The separation of flags is well contained within the DynFlags module,
please have a look!

The work was implemented in D337 <>,
D532 <> and D536
<> and is tracked in trac #9259

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list