Take the 2-minute tour ×

I can see the type of an infix operator in GHCi with :t like so:

>:t (.)

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?

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

:i (:info).

> :i (+)
class Num a where
  (+) :: a -> a -> a
        -- Defined in `GHC.Num'
infixl 6 +
share|improve this answer
Thanks -- anyway to see the source from GHCI, or is that a pipedream? –  Adam Sep 2 '12 at 19:14
@Adam To see the source, you can't use ghci (yet). The haddocks should link to syntax-coloured sources. –  Daniel Fischer Sep 2 '12 at 19:18
Note that you can use hoogle (haskell.org/hoogle) or hayoo (holumbus.fh-wedel.de/hayoo/hayoo.html) to easily access the haddock documentation of a function. –  Jan Christiansen Sep 2 '12 at 19:32
add comment

Your Answer


