Two Hoopl questions

Edward Z. Yang ezyang at MIT.EDU
Fri Jul 26 23:15:02 CEST 2013

Hello Jan,

Re (1), there is an important invariant that your transformations should
uphold to avoid infinite loops.  This invariant is described in the
Hoopl paper:

> • The lattice must have no infinite ascending chains; that is,
> every sequence of calls to fact_join must eventually return
> NoChange.
> • The transfer function must be monotonic: given a more infor-
> mative fact in, it must produce a more informative fact out.
> • The rewrite function must be sound: if it replaces a node n by a
> replacement graph g, then g must be observationally equivalent
> to n under the assumptions expressed by the incoming dataflow
> fact f. Moreover, analysis of g must produce output fact(s) that
> are at least as informative as the fact(s) produced by applying
> the transfer function to n. For example, if the transfer function
> says that x=7 after the node n, then after analysis of g, x had
> better still be 7.
> • A transformation that uses deep rewriting must not return a re-
> placement graph which contains a node that could be rewritten
> indefinitely.

These are all local invariants, so you should go through all of
your data structures and functions and check if they fulfill the

Re optimization fuel, I do not really recommend using it to debug
infinite loops (since what you will need to do is repeatedly run
with different values of fuel and manually look at what kind
of "infinite behavior" is going on. We used to have a flag -dopt-fuel
which did this, but I guess it got removed at some point.

I haven't looked at your other questions closely yet.


More information about the ghc-devs mailing list