我知道perlop.我正在寻找的是像GHCi:info命令一样的快速查找:
ghci> :info (+) class (Eq a,Show a) => Num a where (+) :: a -> a -> a ... -- Defined in GHC.Num infixl 6 +
其中我学习()是左关联的,并且从infixl 6行的优先级为6.
解决方法
我意识到这不是你要求的,但是怎么样:
perl -MO=Deparse,-p -e "print $a+$b*$c**$d;"
它根据优先级在表达式周围打印括号:
print(($a + ($b * ($c ** $d))));
对于perl distibution之外的东西,你可以查看perlopquick – pod的排列方式与你在问题中指定的方式非常相似.