Add -foptimal-applicative-do
authorSimon Marlow <marlowsd@gmail.com>
Fri, 4 Mar 2016 13:06:42 +0000 (13:06 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 11 Mar 2016 16:14:25 +0000 (16:14 +0000)
commit2f45cf3f48162a5f843005755dafa1c5c1b451a7
tree33d4eaacb1e4107228361236cb9946226e8e4e0c
parent7ba817c217d3c5c4dd9550b0cf0f4314b54895a3
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
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