Add -foptimal-applicative-do
authorSimon Marlow <marlowsd@gmail.com>
Fri, 4 Mar 2016 13:06:42 +0000 (13:06 +0000)
committerBartosz Nitka <niteria@gmail.com>
Mon, 25 Jul 2016 14:41:44 +0000 (07:41 -0700)
commit77a9f0130836363f8fe28b179285da949340633d
treea48ee3a61cd9fbe47e31b413c8067de1001ffd50
parentd563710d4277897b4704e7e116d2a805de0ec962
Add -foptimal-applicative-do

Summary:
The algorithm for ApplicativeDo rearrangement is based on a heuristic
that runs in O(n^2).  This patch adds the optimal algorithm, which is
O(n^3), selected by a flag (-foptimal-applicative-do).  It finds better
solutions in a small number of cases (about 2% of the cases where
ApplicativeDo makes a difference), but it can be very slow for large do
expressions.  I'm mainly adding it for experimental reasons.

ToDo: user guide docs

Test Plan: validate

Reviewers: simonpj, bgamari, austin, niteria, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1969

(cherry picked from commit 2f45cf3f48162a5f843005755dafa1c5c1b451a7)
compiler/main/DynFlags.hs
compiler/rename/RnExpr.hs
docs/users_guide/glasgow_exts.rst
testsuite/tests/ado/ado-optimal.hs [new file with mode: 0644]
testsuite/tests/ado/ado-optimal.stdout [new file with mode: 0644]
testsuite/tests/ado/ado004.hs
testsuite/tests/ado/ado004.stderr
testsuite/tests/ado/all.T
utils/mkUserGuidePart/Options/Optimizations.hs