Rewrite rules involving LHS lambda?

Conal Elliott conal at conal.net
Sat Dec 2 17:50:44 UTC 2017


Is there a written explanation and/or examples of rewrite rules involving a
LHS lambda? Since rule matching is first-order, I'm wondering how terms
with lambda are matched on the LHS and substituted into on the RHS. For
instance, I want to restructure a lambda term as follows:

> foo (\ x -> fmap u v) = bar (\ x -> u) (\ x -> v)

My intent is that the terms `u` and `v` may contain `x` and that whatever
variable name is actually used in a term being rewritten is preserved so as
to re-capture its occurrences on the RHS.

When I write this sort of rule, I get warnings about `x` being defined but
not used.

Thanks,  -- Conal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20171202/63a2a410/attachment.html>


More information about the Glasgow-haskell-users mailing list