Reputation: 649
Does ghci
have built-in help? Put differently, is it possible to get help from within ghci
?
For example, I want to now all functions that can be applied to a list.
There is a useful command :info
, which outputs some help, however it is a bit cumbersome.
Upvotes: 3
Views: 817
Reputation: 5038
Since hoogle
was already mentioned. You can easily integrate it into ghci
by first installing the corresponding hackage package using cabal
cabal install hoogle
and then modifying your ~/.ghci
as follows
echo >> ~/.ghci ':def hoogle \x -> return $ ":!hoogle \"" ++ x ++ "\""'
After that you can use :hoogle
from within ghci
.
Note: It might be necessary to do
hoogle data
on the command line, before the :hoogle
command in ghci
works.
Upvotes: 3
Reputation: 1789
You can type :?
to get a list of all ghci commands. A very useful tool is hoogle which is a seearch engine for the Haskell API. You can search functions by their names or by their types, i.e:
(a -> b) -> [a] -> [b]
foldl
...
It provides a short description of the function and a link to its documentation. Hope it helped!
Upvotes: 6