`exprOkForSpeculation` for Note [IO hack in the demand analyser]

In #14998 I realised that the notion of speculative execution
*exactly matches* eager evaluation of expressions in a case alternative
where the scrutinee is an IO action.

Normally we have to `deferIO` any result from that single case
alternative to prevent this speculative execution, so we had a special
case in place in the demand analyser that would check if the scrutinee
was a prim-op, in which case we assumed that it would be ok to do the
eager evaluation.

Now we just check if the scrutinee is `exprOkForSpeculation`,
corresponding to the notion that we want to push evaluation of the
scrutinee *after* eagerly evaluating stuff from the case alternative.

This fixes #14988, because it resolves the last open Item 4 there.
32 jobs for master in 385 minutes and 3 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Lint
passed #166854
lint
lint-linters

00:00:15

passed #166857
lint
lint-submods-branch

00:00:17

passed #166855
lint
lint-testsuite

00:00:14

passed #166856
lint
typecheck-testsuite

00:00:13

 
  Build
passed #166859
x86_64-linux
hadrian-ghc-in-ghci

00:11:48

passed #166861
x86_64-linux
release-x86_64-linux-deb9-dwarf

00:51:13

passed #166860
x86_64-linux
validate-x86_64-linux-deb9-debug

02:14:30

passed #166858
x86_64-linux
validate-x86_64-linux-deb9-hadrian

01:55:24

 
  Full Build
failed #166864
aarch64-linux allowed to fail
nightly-aarch64-linux-deb9

00:11:49

failed #166866
x86_64-linux
nightly-i386-linux-deb9

02:08:21

failed #166878
x86_64-windows allowed to fail
nightly-i386-windows

00:35:12

failed #166875
x86_64-windows allowed to fail
nightly-i386-windows-hadrian

00:47:22

failed #166872
x86_64-linux allowed to fail
nightly-x86_64-linux-alpine

01:39:22

passed #166867
x86_64-linux
nightly-x86_64-linux-deb9

01:57:09

passed #166870
x86_64-linux
nightly-x86_64-linux-deb9-integer-simple

02:00:12

failed #166868
x86_64-linux
nightly-x86_64-linux-deb9-llvm

02:02:22

failed #166877
x86_64-windows allowed to fail
nightly-x86_64-windows

00:39:25

failed #166863
aarch64-linux allowed to fail
validate-aarch64-linux-deb9

00:14:49

passed #166976
x86_64-linux
validate-i386-linux-deb9

01:14:58

passed #166862
x86_64-darwin
validate-x86_64-darwin

00:56:21

passed #166869
x86_64-linux
validate-x86_64-linux-deb9-integer-simple

01:20:15

passed #166871
x86_64-linux
validate-x86_64-linux-deb9-unreg

02:13:57

passed #166873
x86_64-linux
validate-x86_64-linux-fedora27

01:28:05

failed #166876
x86_64-windows allowed to fail
validate-x86_64-windows

00:36:03

failed #166874
x86_64-windows allowed to fail
validate-x86_64-windows-hadrian

02:54:45

failed #166865
x86_64-linux
validate-i386-linux-deb9

00:02:33

 
  Cleanup
passed #166879
x86_64-darwin
cleanup-darwin

00:00:13

 
  Packaging
skipped #166880
x86_64-linux allowed to fail
doc-tarball
 
  Testing
skipped #166881
x86_64-linux allowed to fail manual
hackage
skipped #166882
x86_64-linux
nightly-hackage
skipped #166883
x86_64-linux
perf-nofib
 
  Deploy
skipped #166884
x86_64-linux allowed to fail
pages
 
Name Stage Failure
failed
validate-aarch64-linux-deb9 Full Build
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
WARNING: ghc-*.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
nightly-i386-windows Full Build
Runtime platform                                    arch=amd64 os=windows pid=7504 revision=1f513601 version=11.10.1
WARNING: ghc-*.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=7260 revision=1f513601 version=11.10.1
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 2
failed
nightly-x86_64-linux-alpine Full Build
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
ghc-*.tar.xz: found 1 matching files
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=166872 responseStatus=201 Created token=WEKbyVXs
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=166872 responseStatus=201 Created token=WEKbyVXs
ERROR: Job failed: exit code 1
failed
nightly-aarch64-linux-deb9 Full Build
We will try though...
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
Running after script...
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows Full Build
Runtime platform                                    arch=amd64 os=windows pid=6876 revision=1f513601 version=11.10.1
WARNING: ghc-*.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=5628 revision=1f513601 version=11.10.1
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 2
failed
nightly-x86_64-windows Full Build
Runtime platform                                    arch=amd64 os=windows pid=4932 revision=1f513601 version=11.10.1
WARNING: ghc-*.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=7740 revision=1f513601 version=11.10.1
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 2
failed
nightly-i386-windows-hadrian Full Build
Runtime platform                                    arch=amd64 os=windows pid=1800 revision=1f513601 version=11.10.1
WARNING: ghc.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=4864 revision=1f513601 version=11.10.1
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 1
failed
nightly-x86_64-linux-deb9-llvm Full Build
make[1]: Leaving directory '/builds/ghc/ghc/testsuite/tests'
Makefile:224: recipe for target 'test' failed
make: *** [test] Error 2
Running after script...
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
junit.xml: found 1 matching files
Uploading artifacts to coordinator... ok
id=166868 responseStatus=201 Created token=FKmCA622
ERROR: Job failed: exit code 1
failed
nightly-i386-linux-deb9 Full Build
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
ghc-*.tar.xz: found 1 matching files
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=166866 responseStatus=201 Created token=-eEWdGgd
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=166866 responseStatus=201 Created token=-eEWdGgd
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows-hadrian Full Build
junit.xml: found 1 matching files                  
WARNING: Failed to load system CertPool:crypto/x509: system root pool is not available on Windows
Uploading artifacts to coordinator... ok
id=166874 responseStatus=201 Created token=bLtNUVwA
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=6624 revision=1f513601 version=11.10.1
junit.xml: found 1 matching files

WARNING: Failed to load system CertPool:crypto/x509: system root pool is not available on Windows
Uploading artifacts to coordinator... ok
id=166874 responseStatus=201 Created token=bLtNUVwA
ERROR: Job failed: exit status 1