Commit Graph

14 Commits

Author SHA1 Message Date
Neil Brown
c8b724d2be Merged the latest set of changes from the trunk into the Polyplate branch
I also added the import list to all the Data.Generics imports in the tests (as I did for the other modules recently)
2009-04-10 20:38:29 +00:00
Neil Brown
4672675ba8 Removed the GenericUtils module, now that everything uses Polyplate instead 2009-01-12 18:03:41 +00:00
Adam Sampson
bd9c4dae98 Go back to passing the value to the type-contains function.
This'll make the modification to look at constructors cleaner.
2008-04-02 16:11:13 +00:00
Adam Sampson
d9df114909 Rework gmapMFor so it takes a list of type keys.
This means we only need one gmapMFor function, and we do fewer calls to
typeKey, but we have to make typeKey available for use where it's called.
2008-04-02 15:09:07 +00:00
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
Neil Brown
4f05f0126f Made decompN check the constructor, and added a short test accordingly 2008-02-25 13:39:28 +00:00
Neil Brown
acd57d74de Changed the A.Structured type to be parameterised
This patch is actually an amalgam of multiple (already large) patches.  Those patches conflicted (parameterised Structured vs. changes to usage checking and FlowGraph) and encountered a nasty bug in darcs 1 involving exponential time (see http://wiki.darcs.net/DarcsWiki/ConflictsFAQ for more details).  Reasoning that half an hour (of 100% CPU use) was too long to apply patches, I opted to re-record the parameterised Structured changes as this new large patch.  Here are the commit messages originally used for the patches (which, as mentioned, were already large patches):

A gigantic patch switching all the non-test modules over to using parameterised A.Structured
Changed the FlowGraph module again to handle any sort of Structured you want to pass to it (mainly for testing)
A further gigantic patch changing all the tests to work with the new parameterised Structured
Fixed a nasty bug involving functions being named incorrectly inside transformInputCase
Added a hand-written instance of Data for Structured that allows us to use ext1M properly
Fixed a few warnings in the code
2008-02-05 19:40:27 +00:00
Neil Brown
6c4e7ee713 Added a few more TestLabels 2008-02-05 16:19:16 +00:00
Neil Brown
26dd2fa5c4 Renamed the TestUtil and TreeUtil modules to TestUtils and TreeUtils, to be consistent with the Utils module 2007-12-13 19:05:29 +00:00
Neil Brown
01c7f25f46 Added much more documentation to the FlowGraphTest module 2007-11-12 15:19:12 +00:00
Neil Brown
38c409d378 Added the -fwarn-unused-imports compiler option to warn about unused imports, and then set about pruning and ordering (mostly in my code) the import lists for all the modules 2007-09-27 13:13:46 +00:00
Neil Brown
7ef6d7728f Added helper functions for converting constructors into Constr items 2007-09-12 08:49:14 +00:00
Neil Brown
ad8aab723b Added a function for searching for particular constructors in a tree, and an associated test 2007-09-12 00:11:22 +00:00
Neil Brown
000270f4a8 Created a new module for tests in the common directory (named CommonTest) and moved testIsSafeConversion across 2007-09-11 23:34:45 +00:00