Prohibit RULES changing constructors
authorDavid Feuer <david.feuer@gmail.com>
Thu, 2 Mar 2017 20:01:26 +0000 (15:01 -0500)
committerDavid Feuer <David.Feuer@gmail.com>
Thu, 2 Mar 2017 20:01:28 +0000 (15:01 -0500)
commitbc332b3159613190a4dc33a067c1ab31039a8434
treed8c61a195aba870b4083441dae4f57730b7b09af
parentae67619853d029ea8049a114f44e59f4ca10b990
Prohibit RULES changing constructors

Previously, `RULES` like

```
{-# RULES
"JustNothing" forall x . Just x = Nothing
 #-}
```

were allowed. Simon Peyton Jones say this seems to have been a
mistake, that such rules have never been supported intentionally,
and that he doesn't know if they can break in horrible ways.
Furthermore, Ben Gamari and Reid Barton are considering trying to
detect the presence of "static data" that the simplifier doesn't
need to traverse at all. Such rules do not play well with that.
So for now, we ban them altogether. In most cases, it's possible
to work around the ban using hand-written wrapper functions.

Reviewers: austin, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D3169
compiler/deSugar/DsBinds.hs
docs/users_guide/8.2.1-notes.rst
docs/users_guide/glasgow_exts.rst
testsuite/tests/deSugar/should_compile/T13290.hs [new file with mode: 0644]
testsuite/tests/deSugar/should_compile/T13290.stderr [new file with mode: 0644]
testsuite/tests/deSugar/should_compile/all.T
testsuite/tests/simplCore/should_run/T12689.hs [deleted file]
testsuite/tests/simplCore/should_run/T12689.stdout [deleted file]
testsuite/tests/simplCore/should_run/all.T