Commit Graph

16 Commits

Author SHA1 Message Date
Neil Brown
09e0e46ec2 Added some comments to my changes to GenericUtils 2008-11-25 18:06:14 +00:00
Neil Brown
e5ed7e07b7 Fixed the apply function, which (mainly due to having the wrong type signature, but also its use of extTransformRoute) was not as polymorphic as it should have been, which was breaking the traversal (I think it would only work on one Structured type) 2008-11-14 15:30:02 +00:00
Neil Brown
2a15f4ef5f Filled in all the gaps such that the CheckTest tests now run (including some debug output, for now)
One of the tests fails at the moment because the specification node has two entries associated with it in the flowgraph.  One is the scope-in and one is the scope-out.  I think the analysis is currently picking the scope-out node and looking beyond that, where -- surprise, surprise -- the variable is not used again.  So I need some easy way of telling the flow analyses which of the two nodes I want to start from, in this case and other ones where I also add two nodes related to the same point in the AST.
2008-11-12 16:54:00 +00:00
Neil Brown
98122211ad Got all the new analysis stuff compiling, but with several parts unimplemented 2008-11-12 12:34:32 +00:00
Neil Brown
dc030acabe Changed the FlowGraph stuff to use the new Route type (that includes identifiers) rather than the bare functions as it used to 2008-11-10 14:01:30 +00:00
Neil Brown
d0e2cd7b03 Finally wrestled the Haskell typechecker into submission to add my CheckFramework and its monads, which will hopefully do all that I need 2008-11-08 00:00:09 +00:00
Neil Brown
d6b102838a Added a Route data type that packages up the routing function and an identifier (to provide equality) 2008-11-07 10:08:16 +00:00
Neil Brown
d12b2178de Added an augmented version of Adam's gmapMFor that uses the same generics techniques, but also gives a route to the node to the transformation function 2008-11-06 18:32:35 +00:00
Adam Sampson
87848ad7db Make the TypeSet representation a bit smarter.
It used to just be the list of target type keys. It's now a map from
all possible type keys to a precomputed hit/through/miss decision for
them. gmapMFor can therefore dig into "through" types without needing
to (fail to) apply the generic function first.

This makes less difference than I was expecting: it shaves the time
for cgtest24 from 2m30 down to 2m15.
2008-06-11 12:05:39 +00:00
Adam Sampson
9f172865ff Move DataBox into Utils.
AnyDataItem is effectively the same, so we could reuse DataBox for that
too in the future.
2008-05-09 09:50:42 +00:00
Adam Sampson
0886ab9f9b Abstract the set of types that gmapMFor takes out to a type.
(No change in behaviour, yet.)
2008-04-08 23:13:58 +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
f515b5ce55 Change "find" to "targets", for clarity. 2008-04-02 15:16:47 +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
d2bcd0cde5 Use IntMap.keysSet.
(Thanks to Neil for spotting this!)
2008-03-26 23:19:37 +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