搜索重写规则 [英] Searching for rewrite rules
问题描述
-ddump-rule-firingings
或 -ddump-rule-rewrites
之类的标志时,我只是得到这个规则被引发了,并且引发了它的重写,但是并没有实际的规则本身...... 理想情况下,我想通过GHCi看看重写规则的范围,但实际上我愿意为基础中的重写规则列出一个详尽的列表。
解决方案仍然希望对此有一个很好的答案,但如果没有,我继续做了pdexter建议的内容,并且为规则指定了 base
。 以下是基本规则4.9。
< hr>
有兴趣复制此内容的人:
http ://git.haskell.org/ghc.git
ghc / libraries / base
pcregrep -Mr'\ { - #RULES(。| \\\
)*?# - \}'。
Is there any way to browse or search rewrite rules? When I use flags like -ddump-rule-firings
or -ddump-rule-rewrites
I just get the name of the rule that fired and the rewrite that it caused, but not the actual rule itself...
Ideally I'd like to see what rewrite rules are in scope via GHCi, but realistically I'd be willing to settle for just an exhaustive list of the rewrite rules present in base.
Alright, still hoping for a good answer to this, but if there isn't, I went ahead and did what pdexter suggested and grep'd base
for rules. Here are the rules in base 4.9.
For anyone interested in replicating this:
- clone
http://git.haskell.org/ghc.git
- navigate to
ghc/libraries/base
- grep recursively
pcregrep -Mr '\{-# RULES(.|\n)*?#-\}' .
这篇关于搜索重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!