Is there a quick way to prioritize and associate operators?

I know about perlop. I am looking for a quick search, for example, the GHCi command :info:

ghci> :info (+)
class (Eq a, Show a) => Num a where
    (+) :: a -> a -> a
    ...
    -- Defined in GHC.Num
infixl 6 +

where I study (+)is left-associative and has a priority level of 6 per line infixl 6 +.

+3
source share
2 answers

I understand that this is not quite what you are asking for, but what about:

perl -MO=Deparse,-p -e "print $a+$b*$c**$d;"

it prints parentheses around expressions according to priority:

print(($a + ($b * ($c ** $d))));

And for things from perl scatter, you can look at perlopquick - the device is located very similar, as indicated in your question.

+6
source

, , .

+1

Source: https://habr.com/ru/post/1791525/


All Articles