blob: 74bc84e164953dae6499d2b746223bfdd71754bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
.. _lambda-case:
Lambda-case
-----------
.. extension:: LambdaCase
:shortdesc: Enable lambda-case expressions.
:since: 7.6.1
Allow the use of lambda-case syntax.
The :extension:`LambdaCase` extension enables expressions of the form ::
\case { p1 -> e1; ...; pN -> eN }
which is equivalent to ::
\freshName -> case freshName of { p1 -> e1; ...; pN -> eN }
Note that ``\case`` starts a layout, so you can write ::
\case
p1 -> e1
...
pN -> eN
Additionally, since GHC 9.0.1, combining :extension:`LambdaCase` with
:extension:`Arrows` allows ``\case`` syntax to be used as a command in
``proc`` notation: ::
proc x -> (f -< x) `catchA` \case
p1 -> cmd1
...
pN -> cmdN
|