Improve Applicative and Monad instances in Base

Authored by dfeuer on Nov 2 2014, 3:06 AM.



Move concatMap from GHC.List to GHC.Base so it can be used for the
Applicative and Monad instances for []. Define some Applicative members
directly instead of defining them via Monad ones. Use GND and coercions
to speed up some instances

Diff Detail

rGHC Glasgow Haskell Compiler
Lint OK
No Unit Test Coverage
Build Status
Buildable 1597
Build 1603: GHC Patch Validation (amd64/Linux)
dfeuer updated this revision to Diff 1189.Nov 2 2014, 3:06 AM
dfeuer retitled this revision from to Improve Applicative and Monad instances in Base.
dfeuer updated this object.
dfeuer edited the test plan for this revision. (Show Details)
dfeuer added a reviewer: austin.
dfeuer updated this revision to Diff 1190.Nov 2 2014, 3:16 AM
dfeuer edited edge metadata.

Don't artificially raise the arity of (*>).

dfeuer updated this revision to Diff 1191.Nov 2 2014, 3:31 AM

Revert a change requiring more discussion.

dfeuer updated this revision to Diff 1201.Nov 2 2014, 7:28 PM

Put back thenIO. It's not used anywhere, but it's wired in
for some reason, so removing it leads to validation failures.
We'll deal with this separately.

dfeuer updated this revision to Diff 1202.Nov 2 2014, 8:26 PM

Fix Base import in one test; change expected output in another.

dfeuer added a comment.Nov 2 2014, 9:21 PM

This reduces allocation in cryptarithm2 by 53%. Its only validation failure is a "stat too good" one. I don't currently have things set up to be able to see how to adjust the expected performance.

dfeuer updated this revision to Diff 1203.Nov 2 2014, 10:45 PM
  • Make Data.Monoid a lot smaller
ekmett added a subscriber: ekmett.Nov 3 2014, 1:10 AM

I rather like the coerce changes to Data.Monoid.

hvr requested changes to this revision.Nov 3 2014, 8:10 AM
hvr added a reviewer: hvr.
hvr added a subscriber: hvr.

I generally like the changes, I just don't like this being such a huge patch, mixing up concerns which deserve separate patches & associated reviews.


this seems unrelated to the advertised Applicative/Monad improvements




also an unrelated change?


This is formally an API extension and ought to be a separate commit, with its own separate Trac ticket documenting the library submission process (which was positive, but we should follow the protocol nevertheless, as we're recently being accused of being sloppy in that regard)


what does this INLINE effect again?

This revision now requires changes to proceed.Nov 3 2014, 8:10 AM
dfeuer added inline comments.Nov 3 2014, 2:35 PM

I'm not sure the first one matters. the one on concatMap should help a great deal with fusion.

dfeuer abandoned this revision.Nov 8 2014, 2:30 AM