Commit Graph

20 Commits

Author SHA1 Message Date
Neil Brown
e61a23855a Fixed all the conflicts while merging into the Polyplate branch 2009-04-09 11:01:39 +00:00
Neil Brown
4672675ba8 Removed the GenericUtils module, now that everything uses Polyplate instead 2009-01-12 18:03:41 +00:00
Neil Brown
954664d238 Added some more type synonyms for checks and passes 2008-12-14 18:27:51 +00:00
Neil Brown
890e7ea9a6 Fixed many of the modules to use the new Polyplate-based Traversal system 2008-12-02 18:06:10 +00:00
Neil Brown
a3bcb32937 Switched the Pass and Traversal modules over to Polyplate, breaking most of the other modules 2008-12-02 17:33:55 +00:00
Neil Brown
d529d78846 Added a slightly hacky fastListify function built on top of applyDepthM 2008-11-21 18:54:23 +00:00
Adam Sampson
7a11d0b2c3 Include TypeSet in OpsM.
This means the TypeSet is only rebuilt when the ops are extended, not
each time the operation is applied (curse the unpredictability of
Haskell CAF optimisation).
2008-06-11 12:04:06 +00:00
Neil Brown
21329287e2 Fixed a problem with GHC 6.6 and the new pass mechanism by removing all the dollars that were confusing the type-checker 2008-06-03 16:16:26 +00:00
Adam Sampson
397ba6a3f5 Add some missing type constraints.
These were tripping GHC 6.8's monomorphism restriction warning.
2008-05-26 17:41:38 +00:00
Adam Sampson
6debf9292f Rework Traversal, and convert all passes to use it.
This changes the Traversal API to the one that I've been working on in
the Polyplate branch, but implemented in terms of Data. The
performance isn't as good as the Polyplate version, but the code is a
lot simpler because it doesn't need all the type constraints (and it
doesn't make GHC struggle).

This also reworks all the passes in Tock to use the new API, including
those that previously used makeGeneric (which I've now removed) or
everywhereM. Most of the passes are simpler because of this, and I
suspect it's fixed a few subtle bugs resulting from missing recursion
in makeGeneric code.

I haven't yet profiled this, but subjectively it seems about the same
as the old Traversal (and thus faster for all the passes that didn't
yet use it).
2008-05-25 20:13:57 +00:00
Neil Brown
e72e95625a Added a checkDepthM2 function to the Traversal module 2008-05-17 12:44:55 +00:00
Adam Sampson
7a7e3e2b24 Make GenNavAST generate instances of a "Polyplate" class.
This provides transformM, which we can build applyX (etc.) on top of:
it takes a set of functions, and applies them wherever they could
match in a data structure, without automatically recursing. This is
done using a four(!)-argument typeclass, drawing inspiration from
Biplate.

The resulting 25,000-line set of instances takes a little while to
compile...
2008-05-10 16:27:46 +00:00
Adam Sampson
2d00b1e5c5 Optimise applyX a bit.
This avoids computing the transformation function each time we recurse.
2008-05-07 15:51:09 +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
3da2ad1385 Provide combinators for generic traversals.
The types get hairier, but the code is much simpler!

I've left {check,apply}DepthM{,2} there for now, but reimplemented them in
terms of the new combinators.

Fixes #58.
2008-04-08 14:41:25 +00:00
Adam Sampson
7703eab52f Add applyExplicitM10.
Fortunately all of this will go away once I do the combinator change...
2008-04-07 21:34:34 +00:00
Adam Sampson
8bbca0f760 Add applyExplicitM9 (as a stopgap). 2008-04-04 12:10:32 +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
7d9110a9b0 Remove "Data t =>" qualifications from transformation types.
This is solely because GHC 6.6 doesn't like them (it complains about the type
variable already being in scope -- which it is, but there's nothing I can do
about that!). This doesn't lose any safety; if you try to write a
transformation for something that's not Data you'll find out when you try to
pass it to one of the application functions.
2008-04-01 12:31:20 +00:00
Adam Sampson
7525138c96 Defined types for tree traversals, and moved them to their own file.
We now have three kinds of canned tree traversals, all of which are smart about
which types they're applied to: explicit-descent transformations,
implicit-descent transformations, and implicit-descent checks. I've only
provided depth-first application of the latter two, but we could do
breadth-first in the future if necessary.
2008-04-01 12:01:09 +00:00