How to check Haskell infix operator precedence
-
29-06-2021 - |
Question
I can see the type of an infix operator in GHCi with :t like so:
>:t (.)
(.) :: (b -> c) -> (a -> b) -> a -> c
How can i see the operator precedence in GHCi? is that possible?
Also, bonus question, is there a way to see the source of these prelude functions through ghci?
Solution
:i
(:info
).
[Prelude]
> :i (+)
class Num a where
(+) :: a -> a -> a
...
-- Defined in `GHC.Num'
infixl 6 +
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow