Let the specialiser work on dicts under lambdas
authorSandy Maguire <sandy@sandymaguire.me>
Thu, 16 May 2019 16:12:10 +0000 (12:12 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Sun, 26 May 2019 12:57:20 +0000 (08:57 -0400)
commit2d0cf6252957b8980d89481ecd0b79891da4b14b
tree5857aa9938a0a587da3a53539ef2eb6f3c32f1d9
parent9be1749d24211c1a78334692d34be10dbc650371
Let the specialiser work on dicts under lambdas

Following the discussion under #16473, this change allows the
specializer to work on any dicts in a lambda, not just those that occur
at the beginning.

For example, if you use data types which contain dictionaries and
higher-rank functions then once these are erased by the optimiser you
end up with functions such as:

```
  go_s4K9
  Int#
  -> forall (m :: * -> *).
     Monad m =>
     (forall x. Union '[State (Sum Int)] x -> m x) -> m ()
```

The dictionary argument is after the Int# value argument, this patch
allows `go` to be specialised.
compiler/specialise/Specialise.hs
testsuite/tests/perf/compiler/Makefile
testsuite/tests/perf/compiler/T16473.hs [new file with mode: 0644]
testsuite/tests/perf/compiler/T16473.stdout [new file with mode: 0644]
testsuite/tests/perf/compiler/all.T
testsuite/tests/simplCore/should_compile/T7785.stderr
testsuite/tests/warnings/should_compile/T16282/T16282.stderr