38
votes

I wanted to use {-# LANGUAGE OverloadedStrings #-} but I forgot how it's called. This kind of thing isn't hoogle-able, and also it takes some time finding using google*.

Is there somewhere a list of GHC extensions named as they are in the LANGUAGE pragma?

* My googling search journey:

7

7 Answers

29
votes

ghci's tab-completion knows. Type :set -X at a ghci prompt, then hit Tab, and you'll get a full list. Or :set -XFoo then Tab will get you a list of all extensions beginning with Foo.

25
votes

The "Language options" section of the flag reference page has a list that's much more easily browseable than the language features page.

Once you're there a Ctrl-F search for "overloaded" takes you right to what you want.

22
votes
$ ghc --supported-languages

(from GHC docs)

3
votes

When using Leksah IDE, selecting Package menu, then Edit Package menu item, then Extension tab also gives you a checkable list.

3
votes

ghc-mod for Emacs found here: http://hackage.haskell.org/package/ghc-mod, includes completion for language extensions. If you are an Emacs user, I suggest you to try it.

2
votes

My dumb hacky way of doing such things:

$ man ghc | grep String
       -XExtendedDefaultRules   -XNoExtendedDefaultRules   -XOverloadedStrings
       -XNoOverloadedStrings  -XGADTs -XNoGADTs   -XGADTSyntax  -XNoGADTSyntax
1
votes

The Cabal package provides a Language.Haskell.Extension module which exports a KnownExtension type whose each constructor is an extension.

The documentation of each constructor briefly describes the extension and provides a link to the GHC user guide.