diff options
author | Jakob Bruenker <jakob.bruenker@gmail.com> | 2022-03-21 00:14:25 +0100 |
---|---|---|
committer | Jakob Bruenker <jakob.bruenker@gmail.com> | 2022-04-01 20:31:08 +0200 |
commit | 32070e6c2e1b4b7c32530a9566fe14543791f9a6 (patch) | |
tree | f0913ef2a69fd660542723ec07240167dbd37961 /docs/users_guide/exts/empty_case.rst | |
parent | d85c7dcb7c457efc23b20ac8f4e4ae88bae5b050 (diff) | |
download | haskell-32070e6c2e1b4b7c32530a9566fe14543791f9a6.tar.gz |
Implement \cases (Proposal 302)
This commit implements proposal 302: \cases - Multi-way lambda
expressions.
This adds a new expression heralded by \cases, which works exactly like
\case, but can match multiple apats instead of a single pat.
Updates submodule haddock to support the ITlcases token.
Closes #20768
Diffstat (limited to 'docs/users_guide/exts/empty_case.rst')
-rw-r--r-- | docs/users_guide/exts/empty_case.rst | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/users_guide/exts/empty_case.rst b/docs/users_guide/exts/empty_case.rst index c42de22e9e..7a32f609e6 100644 --- a/docs/users_guide/exts/empty_case.rst +++ b/docs/users_guide/exts/empty_case.rst @@ -19,6 +19,9 @@ or :: \case { } -- -XLambdaCase is also required +Note that it is not allowed for ``\cases``, since it would be unclear how many +patterns are being matched. + This can be useful when you know that the expression being scrutinised has no non-bottom values. For example: @@ -45,5 +48,3 @@ We much prefer (B). Why? Because GHC can figure out that is able to compile with :ghc-flag:`-Wincomplete-patterns` and :ghc-flag:`-Werror`. On the other hand (A) looks dangerous, and GHC doesn't check to make sure that, in fact, the function can never get called. - - |