From 8c98c897d1617524176840118a8777849d7784ab Mon Sep 17 00:00:00 2001 From: lazyLambda <galen.sprout@gmail.com> Date: Fri, 7 Mar 2025 11:15:40 -0500 Subject: [PATCH] Driver: make MonadComprehensions imply ParallelListComp This commit changes GHC.Driver.Flags.impliedXFlags to make the MonadComprehensions extension enable the ParallelListComp extension. Fixes #25645 --- compiler/GHC/Driver/Flags.hs | 2 +- docs/users_guide/9.14.1-notes.rst | 2 ++ docs/users_guide/exts/monad_comprehensions.rst | 2 ++ docs/users_guide/exts/parallel_list_comprehensions.rst | 2 ++ testsuite/tests/parser/should_fail/readFail038.stderr | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index 71a76e262d25..85d1354d51a6 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -330,7 +330,7 @@ impliedXFlags , (LangExt.RecordWildCards, On LangExt.DisambiguateRecordFields) , (LangExt.ParallelArrays, On LangExt.ParallelListComp) - + , (LangExt.MonadComprehensions, On LangExt.ParallelListComp) , (LangExt.JavaScriptFFI, On LangExt.InterruptibleFFI) , (LangExt.DeriveTraversable, On LangExt.DeriveFunctor) diff --git a/docs/users_guide/9.14.1-notes.rst b/docs/users_guide/9.14.1-notes.rst index 112c04597a9d..81e787385908 100644 --- a/docs/users_guide/9.14.1-notes.rst +++ b/docs/users_guide/9.14.1-notes.rst @@ -78,6 +78,8 @@ Language This causes the constructor to have type ``Rec :: Int %'Many -> Char %1 -> Record``. +* The :extension:`MonadComprehensions` extension now implies :extension:`ParallelListComp` as was originally intended (see `Monad Comprehensions <https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/monad_comprehensions.html>`_). + Compiler ~~~~~~~~ diff --git a/docs/users_guide/exts/monad_comprehensions.rst b/docs/users_guide/exts/monad_comprehensions.rst index 260d8305ba89..2bb6de10d0b2 100644 --- a/docs/users_guide/exts/monad_comprehensions.rst +++ b/docs/users_guide/exts/monad_comprehensions.rst @@ -9,6 +9,8 @@ Monad comprehensions .. extension:: MonadComprehensions :shortdesc: Allow list comprehension syntax to be used at monads other than ``List``. + :implies: :extension:`ParallelListComp` + :since: 7.2.1 Enable list comprehension syntax for arbitrary monads. diff --git a/docs/users_guide/exts/parallel_list_comprehensions.rst b/docs/users_guide/exts/parallel_list_comprehensions.rst index 2e1863dc9f98..b4f0614ced6a 100644 --- a/docs/users_guide/exts/parallel_list_comprehensions.rst +++ b/docs/users_guide/exts/parallel_list_comprehensions.rst @@ -10,6 +10,8 @@ Parallel List Comprehensions .. extension:: ParallelListComp :shortdesc: Allow parallel list comprehension syntax. + :implied by: :extension:`MonadComprehensions` + :since: 6.8.1 Allow parallel list comprehension syntax. diff --git a/testsuite/tests/parser/should_fail/readFail038.stderr b/testsuite/tests/parser/should_fail/readFail038.stderr index 5e637dfe2599..4370d81c2a1b 100644 --- a/testsuite/tests/parser/should_fail/readFail038.stderr +++ b/testsuite/tests/parser/should_fail/readFail038.stderr @@ -2,4 +2,4 @@ readFail038.hs:5:9: error: [GHC-42026] Unexpected parallel statement in a list comprehension Suggested fix: - Perhaps you intended to use the ‘ParallelListComp’ extension (implied by ‘ParallelArrays’) + Perhaps you intended to use the ‘ParallelListComp’ extension (implied by ‘ParallelArrays’ and ‘MonadComprehensions’) -- GitLab