Optimize MonadUnique instances based on IO (#16843)

```----------------------
Metric Decrease:
    T14683
```

----------------------
22 jobs for !1502 with T16843 in 452 minutes and 46 seconds (queued for 3 seconds)
detached
Status Job ID Name Coverage
  Lint
passed #199906
lint
ghc-linters

00:01:06

passed #199907
lint
lint-linters

00:01:00

passed #199910
lint allowed to fail
lint-submods-mr

00:00:19

passed #199908
lint
lint-testsuite

00:00:16

passed #199909
lint
typecheck-testsuite

00:00:16

 
  Quick Build
passed #199911
x86_64-linux
hadrian-ghc-in-ghci

00:11:09

 
  Build
passed #199914
x86_64-linux
release-x86_64-linux-deb9-dwarf

01:53:52

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

03:44:07

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

02:22:31

 
  Full Build
failed #199917
aarch64-linux allowed to fail
validate-aarch64-linux-deb9

03:11:37

failed #199918
armv7-linux allowed to fail
validate-armv7-linux-deb9

03:12:35

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

01:11:18

passed #199916
x86_64-darwin
validate-x86_64-darwin

01:21:47

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

01:58:31

passed #199915
x86_64-linux
validate-x86_64-linux-deb9-unreg-hadrian

02:42:49

passed #199921
x86_64-linux
validate-x86_64-linux-fedora27

01:14:22

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

02:50:23

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

01:27:32

 
  Cleanup
passed #199924
x86_64-darwin
cleanup-darwin

00:00:05

 
  Packaging
failed #199925
x86_64-linux allowed to fail
doc-tarball

00:01:24

 
  Testing
manual #199926
x86_64-linux allowed to fail manual
hackage
passed #199927
x86_64-linux
perf-nofib

00:21:42

 
Name Stage Failure
failed
doc-tarball Packaging
Submodule path 'utils/hsc2hs': checked out '17ba2dce8fcd83590ddb679351f6226d45a5b9cc'
$ git checkout .gitmodules
$ git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true
warning: no common commits
From https://gitlab.haskell.org/ghc/ghc-performance-notes
* [new ref] refs/notes/perf -> refs/notes/perf
$ if [ ! -f "$LINUX_BINDIST" ]; then # collapsed multi-line command
Error: ghc-x86_64-mingw32.tar.xz does not exist. Did the 64-bit Windows job fail?
ERROR: Job failed: exit code 1
failed
validate-armv7-linux-deb9 Full Build
Uploading artifacts...
ghc-armv7-linux-deb9.tar.xz: found 1 matching files
junit.xml: found 1 matching files

performance-metrics.tsv: found 1 matching files

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

Uploading artifacts to coordinator... ok
id=199918 responseStatus=201 Created token=SM1pWsyn
ERROR: Job failed: exit code 1
failed
validate-aarch64-linux-deb9 Full Build
Uploading artifacts...
ghc-aarch64-linux-deb9.tar.xz: found 1 matching files
junit.xml: found 1 matching files

performance-metrics.tsv: found 1 matching files

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

Uploading artifacts to coordinator... ok
id=199917 responseStatus=201 Created token=YsU1sVy3
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows 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=199923 responseStatus=201 Created token=xNiRCADW
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=3808 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=199923 responseStatus=201 Created token=xNiRCADW
ERROR: Job failed: exit status 2
failed
validate-x86_64-windows-hadrian Full Build
ghc.tar.xz: found 1 matching files                 
WARNING: junit.xml: no matching files
WARNING: Failed to load system CertPool:crypto/x509: system root pool is not available on Windows
Uploading artifacts to coordinator... ok
id=199922 responseStatus=201 Created token=5e35KXPH
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=3852 revision=1f513601 version=11.10.1
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 9009