:info
, or just :i
, is what you want:
>>> :i Either
data Either a b = Left a | Right b -- Defined in ‘Data.Either’
... plus all of Either's instances
From the GHCi documentation:
:info name ...
Displays information about the given name(s). For example, if name is
a class, then the class methods and their types will be printed; if
name is a type constructor, then its definition will be printed; if
name is a function, then its type will be printed. If name has been
loaded from a source file, then GHCi will also display the location of
its definition in the source.
Haskell-mode in Emacs has haskell-process-do-info
(source), for which one Haskell on Emacs Tutorial recommends setting the keybinding C-c C-n C-i
.
(defun haskell-process-do-info (&optional prompt-value)
"Print info on the identifier at point.
If PROMPT-VALUE is non-nil, request identifier via mini-buffer."
...
)