tock-mirror/common
Adam Sampson eb29e65bad Smarter tree traversals: "Scrap Your Uniplate".
This provides gmapMFor and gmapMFor2, which are like gmapM, but know what
they're looking for, and can therefore avoid going down branches of the tree
that won't contain any interesting types.

The basic approach is quite similar to Uniplate's PlateData: there's a function
(containsType) that'll tell you whether one type is contained somewhere within
another. However, unlike Uniplate, we build a static IntMap IntSet of the types
we need to know about, which allows rather quicker lookups. (I did try using
PlateData first.)

The result is that applyDepthM is now much quicker than it was before.
applyDepthM2 is a bit less impressive, which I assume is because it can't
really prune the tree much if it's looking for two types.

Future enhancements:
- convert more passes to use applyDepthM*;
- make gmapMFor* aware of constructors rather than just types, which should
  allow a bit more pruning.
2008-03-20 16:49:24 +00:00
..
CommonTest.hs Smarter tree traversals: "Scrap Your Uniplate". 2008-03-20 16:49:24 +00:00
Errors.hs Changed the error reporting so that we at least print the meta tag if we can't open the file to find the line 2008-02-11 01:15:56 +00:00
EvalConstants.hs Move Retypes checking from the occam parser into a pass. 2008-03-19 19:38:56 +00:00
EvalLiterals.hs Fixed signed hexed values in the constant folder 2008-02-27 14:00:28 +00:00
GenericUtils.hs Smarter tree traversals: "Scrap Your Uniplate". 2008-03-20 16:49:24 +00:00
Intrinsics.hs Implement the RESCHEDULE intrinsic. 2008-03-15 11:00:11 +00:00
Pattern.hs Added the -fwarn-missing-signatures option and added all missing type signatures for non-test modules (and most for test modules too) 2008-02-05 23:06:03 +00:00
PrettyShow.hs Initial implementation of the occam-pi preprocessor. 2008-02-28 20:27:30 +00:00
ShowCode.hs Change A.Dimension to take an Expression, not an Int. 2008-03-18 16:45:38 +00:00
TestFramework.hs Moved all the testPass* functions into the TestMonad, using unsafePerformIO for running them inside QuickCheck 2008-03-05 16:06:14 +00:00
TestHarness.hs Remove now-unused code for running timed tests. 2008-03-12 18:21:22 +00:00
TestUtils.hs Move Retypes checking from the occam parser into a pass. 2008-03-19 19:38:56 +00:00
TreeUtils.hs Moved all the testPass* functions into the TestMonad, using unsafePerformIO for running them inside QuickCheck 2008-03-05 16:06:14 +00:00
Types.hs Change A.Dimension to take an Expression, not an Int. 2008-03-18 16:45:38 +00:00
Utils.hs Change A.Dimension to take an Expression, not an Int. 2008-03-18 16:45:38 +00:00