Hoopl: Examples of wrapFR or wrapBR?
Edward Z. Yang
ezyang at MIT.EDU
Sun Jun 26 00:54:03 CEST 2011
Hello Justin,
If you grep Hoopl's source code for wrapFR and wrapBR, you can find
uses of the methods. For example:
thenFwdRw :: forall m n f. Monad m
=> FwdRewrite m n f
-> FwdRewrite m n f
-> FwdRewrite m n f
-- @ end comb1.tex
thenFwdRw rw3 rw3' = wrapFR2 thenrw rw3 rw3'
where
thenrw :: forall m1 e x t t1.
Monad m1 =>
(t -> t1 -> m1 (Maybe (Graph n e x, FwdRewrite m n f)))
-> (t -> t1 -> m1 (Maybe (Graph n e x, FwdRewrite m n f)))
-> (t -> t1 -> m1 (Maybe (Graph n e x, FwdRewrite m n f)))
thenrw rw rw' n f = rw n f >>= fwdRes
where fwdRes Nothing = rw' n f
fwdRes (Just gr) = return $ Just $ fadd_rw rw3' gr
This usage of wrapFR2 doesn't take advantage of the extra polymorphism of
wrapFR2, but it takes two forward rewrites and composes them into a single rewrite.
Edward
More information about the Glasgow-haskell-users
mailing list