本文介绍了搜索重写规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 有没有什么方法可以浏览或搜索重写规则?当我使用诸如 -ddump-rule-firingings 或 -ddump-rule-rewrites 之类的标志时,我只是得到这个规则被引发了,并且引发了它的重写,但是并没有实际的规则本身...... 理想情况下,我想通过GHCi看看重写规则的范围,但实际上我愿意为基础中的重写规则列出一个详尽的列表。 解决方案仍然希望对此有一个很好的答案,但如果没有,我继续做了pdexter建议的内容,并且为规则指定了 base 。 以下是基本规则4.9。 有兴趣复制此内容的人: 克隆 http ://git.haskell.org/ghc.git 导航到 ghc / libraries / base grep递归地 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.gitnavigate to ghc/libraries/basegrep recursively pcregrep -Mr '\{-# RULES(.|\n)*?#-\}' . 这篇关于搜索重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-19 08:32