Skip to content

Remove GHCJS - #12396

Open
philderbeast wants to merge 13 commits into
haskell:masterfrom
cabalism:remove/ghcjs
Open

philderbeast wants to merge 13 commits into
haskell:masterfrom
cabalism:remove/ghcjs

Conversation

@philderbeast

@philderbeast philderbeast commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #11609, removing GHCJS.

I'll squash commits before applying the merge label if this pull request is approved.

Important

The removed exceptions and ghcjsVersionImplInfo were exported from Cabal,
so this needs a major version bump.

GHCJS was a standalone compiler that predates the JavaScript backend of GHC, which shipped with GHC 9.6. Its repository has been dormant for years and Cabal's Distribution.Simple.GHCJS module was a stranded, untested duplicate of the GHC module.

What is removed

  • The Distribution.Simple.GHCJS module and its PackageTests/GHCJS test.
  • The --ghcjs flag and the ghcjs and ghcjs-pkg builtin programs, with the ghcjs-* lines they contributed to the generated config file and the program lists in the help text and the manual.
  • ghcjsVersionImplInfo and the GHCJS branch of getImplInfo.
  • The VersionMismatchJS (9001) and VersionMismatchGHCJS (4001) exceptions. Their codes are marked retired.
  • Every GHCJS -> case left in Cabal and cabal-install. None were reachable once configure could no longer produce the flavour.

Selecting the flavour, with compiler: ghcjs in a project file or on the Setup configure command line, now fails with a dedicated error:

Error: [Cabal-4002]
GHCJS is no longer supported. Use the JavaScript backend of GHC instead,
for example with --with-compiler=javascript-unknown-ghcjs-ghc.

What is kept

  • In Cabal-syntax, the GHCJS constructor of CompilerFlavor, PerCompilerFlavor and the ghcjs-options, ghcjs-prof-options, ghcjs-shared-options and ghcjs-prof-shared-options fields. Packages on Hackage use these fields and must keep parsing. The manual marks them deprecated and ignored.
  • OS Ghcjs and the ghcjs_HOST_OS CPP guards. These describe the javascript-unknown-ghcjs target that the JavaScript backend of GHC still uses, not the GHCJS compiler.

Deprecation process

The deprecation process that asks for a four release window is skipped in favour of a faster removal I proposed on discourse. So far, we've received no objections.

QA Notes

  • cabal build in a project with compiler: ghcjs in cabal.project should fail with [Cabal-4002] and the message above.
  • cabal build --ghcjs should be rejected as an unrecognised option.
  • cabal build --help should no longer list --ghcjs, and the --with-PROG program list should no longer include ghcjs or ghcjs-pkg.
  • A fresh ~/.config/cabal/config should have no ghcjs-location, ghcjs-pkg-location, ghcjs-options or ghcjs-pkg-options lines.
  • A package with ghcjs-options: -foo should still configure and build with GHC, with no warning and no effect.

Tests

  • PackageTests/GHCJS/NotSupported checks the new error.
  • The IntegrationTests2 config test drops its ghcjs-* assertions and passes.
  • The project-config-shared parser test uses uhc instead of ghcjs as its sample flavour.
  • The help text under doc/ was regenerated with make -B -C doc cmd-help and make users-guide builds the manual cleanly.

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@zlonast zlonast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the work done!

@andreabedini andreabedini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC project fields like ghcjs-options and the like will now cause a unknown field warning, am I correct? It would be better to say "deprecated". The changelog say they are ignored, it might be worth being more specific.

Comment on lines +158 to +164
(path, runArgs) <-
let exeName' = prettyShow $ exeName exe
in case compilerFlavor (compiler lbiForExe) of
GHCJS -> do
let (script, cmd, cmdArgs) =
GHCJS.runCmd
(withPrograms lbiForExe)
(i buildPref </> exeName' </> exeName')
script' <- tryCanonicalizePath script
return (cmd, cmdArgs ++ [script'])
_ -> do
p <-
tryCanonicalizePath $
i buildPref </> exeName' </> (exeName' <.> exeExtension (hostPlatform lbiForExe))
return (p, [])
in do
p <-
tryCanonicalizePath $
i buildPref </> exeName' </> (exeName' <.> exeExtension (hostPlatform lbiForExe))
return (p, [])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ca be all collapsed now. runArgs is always [], path is tryCanonicalizePath ....

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've removed runArgs and renamed path to exePath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Close the GHCJS support window?

3 participants