GHC has LANGUAGE extensions that Cabal doesn't know about #1050

simonpj opened this Issue Sep 28, 2012 · 6 comments


None yet

6 participants

simonpj commented Sep 28, 2012

What is the protocol for updating Cabal's list of LANGUAGE extensions?

GHC has a test (driver/T4437) that tests the difference between GHC's LANGUAGE extensions and Cabals. It has a list expectedGhcOnlyExtensions for ones GHC knows about but Cabal doesn't. Current state of play is below.

But ultimately these extensions should end up in Cabal. But how?


expectedGhcOnlyExtensions :: [String]
expectedGhcOnlyExtensions = ["ParallelArrays",

hvr commented Oct 9, 2012

fwiw, here's a fragment of a discussion on #ghc that took place on Mon Sep 24 2012:

10:25 < hvr> dcoutts_: how often is/should the language-extension list known by Cabal updated?
10:26 < hvr> I noticed, that the latest Cabal doesn't know about  couple of GHC 7.[46] language extensions, and thus warns
12:35 < dcoutts_> hvr: the list should be updated whenever any compiler releases new extensions that they think are ready for general consumption
12:36 < dcoutts_> hvr: I submitted a test for the ghc test suite to check for the case when ghc has extensions that are not yet included in the Language.Haskell.Extensions list
12:36 < dcoutts_> but it seems that test must not be included / working, since 7.6.1 did get released without registering the new extensions
12:37 < dcoutts_> Igloo, JaffaCake: ^^ could you check that the cabal extensions test is included in the ghc testsuite? it should stop this from happening
12:39 < Igloo> I think the problem is that people add the extension to the ignore-list, either because that's easier or because the extension is not yet ready, and then it never gets looked at again
12:39 < dcoutts_> mm
12:40 < dcoutts_> tricky, since we do need the ignore list, e.g. PArr was on there deliberately for a long time
12:40 < Igloo> but I can't actually find the test now. I don't suppose you know what it's called?
12:40 < dcoutts_> Igloo: I don't think I gave it a name in the context of the testsuite, I think I just submitted the program
12:40 < dcoutts_> so I don't know/recall
12:42 < Igloo> It's possible I removed it as it wasn't doing anything useful
12:42 < dcoutts_> :-)
12:42  * Igloo tries searching the logs
12:42 < dcoutts_> Igloo: perhaps the thing to do is to put it into the full testsuite, but not the validate
12:42 < dcoutts_> so people don't just add new extensions to the ignore list
12:42 < dcoutts_> the validate subset I mean
12:44 < Igloo> Well, people ought to fix test failures regardless of whether or not they're in the validate subset
12:45 < dcoutts_> Igloo: but you can see that this is a little different, people need to be able to add experimental extensions
12:45 < dcoutts_> checking the extensions are registered is something that needs to be done shortly before release
12:45 < Igloo> This test used the --supported-languages flag to GHC, right?
12:45 < dcoutts_> Igloo: almost certainly
12:48 < Igloo> Ah, it's in the Cabal repo
12:49 < dcoutts_> I think I added it there as backup, and sent it in by email
12:49 < Igloo> Oh
12:51 < Igloo> OK, it certainly used to exist and get run, but now I can't find any trace of it
dcoutts commented Oct 9, 2012

It's just a matter of adding the extensions into Language.Haskell.Extension in the Cabal library along with a line or two of haddock documentation.

hvr commented Oct 16, 2012

@dcoutts I wanted to give it a go, but I got confused about the documentation part:

There's a comment demanding:

-- Where applicable, references are given to an implementation's
-- official documentation, e.g. \"GHC &#xa7; 7.2.1\" for an extension
-- documented in section 7.2.1 of the GHC User's Guide.

the problem now is, that there seem to be quite a bit of bogus/outdated section-references in there, e.g.:

  -- | [GHC &#xa7; 7.40] Allow type class/implicit parameter/equality
  -- constraints to be used as types with the special kind Constraint.
  -- Also generalise the (ctxt => ty) syntax so that any type of kind
  -- Constraint can occur before the arrow.
  | ConstraintKinds

There's no 7.40 section in the GHC manual (the last section in chapter 7 is 7.25.6. Safe Haskell Flag Summary), also quite a few other references have been broken by inserting new section headings and thus affecting the section enumeration in a non backward-compatible way.

So... if we continue to reference the manual sections by their section numbers, maybe we should also add the version/edition the references apply to?

@hvr hvr added a commit to hvr/cabal that referenced this issue Oct 19, 2012
@hvr hvr Add a couple of new language extension flags known by GHC 7.[46]

 - `CApiFFI`
 - `DataKinds`
 - `DefaultSignatures`
 - `DeriveGeneric`
 - `InstanceSigs`
 - `InterruptibleFFI`
 - `LambdaCase`
 - `MonadComprehensions`
 - `MultiWayIf`
 - `ParallelArrays`
 - `PolyKinds`
 - `TraditionalRecordSyntax`
 - `Unsafe`

This addresses #1050

As of now, the expectedGhcOnlyExtensions list looks like this:

expectedGhcOnlyExtensions :: [String]
expectedGhcOnlyExtensions = [
@ttuegel ttuegel added this to the Cabal-1.24 milestone Apr 23, 2015

Already fixed, I think? (Though I disagree with referring to the documentation unless it's something that cabal users can actually see somewhere. It's not like Google doesn't exist.)


Yes, I think this can be closed. Please open separate issues/PRs for individual extensions that need to be registered with Cabal.

@23Skidoo 23Skidoo closed this Jun 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment