The type of (forward) rewriting functions in Hoopl is given by the mkFRewrite
function:
mkFRewrite :: (FuelMonad m) =>
(forall e x.
n e x
-> f
-> m (Maybe (hoopl-3.8.6.1:Compiler.Hoopl.Dataflow.Graph n e x)))
-> FwdRewrite m n f
The m
type implies that I can use monadic effects while rewriting. The paper "Hoopl: A Modular, Reusable Library for Dataflow Analysis and Transformation" says the same in Section 4.3, "The rewrite function and the client's monad."
Can anyone give me an example of a rewrite function that has non-Hoopl monadic effects embedded inside it? For example, a rewriter that uses a State monad or does some IO.