I can't find where I saw this but I found somewhere on a reddit discussion the following syntax in a do block:
do
case (<- fooM) of
Foo x -> ..
...
instead of the usual
do
foo <- fooM
case foo of
Foo x -> ..
...
Which would be extremely useful but it doesn't seem to work (without a language extension) and I was wondering if it was just shorthand of the post author or if I am missing a language extension.
Note that I understand that this syntax is ambiguous for example
(`execState` 0) $ do
return $ (<- put 3) <> (<- put 4) <> (<- put 5)
We may get 3, 4 or 5 but there could be semantics to mitigate this.